mirror of
https://github.com/actions/setup-java.git
synced 2024-12-19 22:59:06 +00:00
Add Shared Runner to README
Be the docs for the feature you want to see. #docsdrivendevelopment
This commit is contained in:
parent
551e2a2770
commit
4757680fc9
36
README.md
36
README.md
@ -13,7 +13,7 @@ This action sets up a java environment for use in actions by:
|
|||||||
|
|
||||||
See [action.yml](action.yml)
|
See [action.yml](action.yml)
|
||||||
|
|
||||||
Basic:
|
## Basic
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
@ -25,7 +25,7 @@ steps:
|
|||||||
- run: java -cp java HelloWorldApp
|
- run: java -cp java HelloWorldApp
|
||||||
```
|
```
|
||||||
|
|
||||||
From local file:
|
## Local file
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
@ -37,7 +37,7 @@ steps:
|
|||||||
- run: java -cp java HelloWorldApp
|
- run: java -cp java HelloWorldApp
|
||||||
```
|
```
|
||||||
|
|
||||||
Matrix Testing:
|
## Matrix Testing
|
||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@ -56,7 +56,7 @@ jobs:
|
|||||||
- run: java -cp java HelloWorldApp
|
- run: java -cp java HelloWorldApp
|
||||||
```
|
```
|
||||||
|
|
||||||
Publishing using Apache Maven:
|
## Publishing using Apache Maven
|
||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@ -91,7 +91,7 @@ jobs:
|
|||||||
|
|
||||||
See the help docs on [Publishing a Package](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-apache-maven-for-use-with-github-packages#publishing-a-package) for more information on the `pom.xml` file.
|
See the help docs on [Publishing a Package](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-apache-maven-for-use-with-github-packages#publishing-a-package) for more information on the `pom.xml` file.
|
||||||
|
|
||||||
Publishing using Gradle:
|
## Publishing using Gradle
|
||||||
```yaml
|
```yaml
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
@ -118,6 +118,32 @@ jobs:
|
|||||||
|
|
||||||
See the help docs on [Publishing a Package with Gradle](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-gradle-for-use-with-github-packages#example-using-gradle-groovy-for-a-single-package-in-a-repository) for more information on the `build.gradle` configuration file.
|
See the help docs on [Publishing a Package with Gradle](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-gradle-for-use-with-github-packages#example-using-gradle-groovy-for-a-single-package-in-a-repository) for more information on the `build.gradle` configuration file.
|
||||||
|
|
||||||
|
## Apache Maven within a Shared Runner
|
||||||
|
|
||||||
|
When using an Actions shared runner the default `$HOME` directory can be shared by a number of workflows at the same time which could overwrite existing settings file. Setting the `m2-home` variable allows you to choose a unique location for your settings file.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Set up JDK 1.8 for Shared Runner
|
||||||
|
uses: actions/setup-java@v1
|
||||||
|
with:
|
||||||
|
java-version: 1.8
|
||||||
|
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||||
|
username: ${{ github.actor }} # username for server authentication
|
||||||
|
password: ${{ github.token }} # password or token for authentication
|
||||||
|
m2-home: ${{ $GITHUB_WORKSPACE }} # location of the .m2 directory
|
||||||
|
- name: Build with Maven
|
||||||
|
run: mvn -B package --file pom.xml
|
||||||
|
- name: Publish to GitHub Packages Apache Maven
|
||||||
|
run: mvn deploy
|
||||||
|
```
|
||||||
|
|
||||||
# License
|
# License
|
||||||
|
|
||||||
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
The scripts and documentation in this project are released under the [MIT License](LICENSE)
|
||||||
|
Loading…
Reference in New Issue
Block a user