Skip to content

Commit 4757680

Browse files
author
Bryan Clark
committed
Add Shared Runner to README
Be the docs for the feature you want to see. #docsdrivendevelopment
1 parent 551e2a2 commit 4757680

1 file changed

Lines changed: 31 additions & 5 deletions

File tree

README.md

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This action sets up a java environment for use in actions by:
1313

1414
See [action.yml](action.yml)
1515

16-
Basic:
16+
## Basic
1717
```yaml
1818
steps:
1919
- uses: actions/checkout@v1
@@ -25,7 +25,7 @@ steps:
2525
- run: java -cp java HelloWorldApp
2626
```
2727
28-
From local file:
28+
## Local file
2929
```yaml
3030
steps:
3131
- uses: actions/checkout@v1
@@ -37,7 +37,7 @@ steps:
3737
- run: java -cp java HelloWorldApp
3838
```
3939
40-
Matrix Testing:
40+
## Matrix Testing
4141
```yaml
4242
jobs:
4343
build:
@@ -56,7 +56,7 @@ jobs:
5656
- run: java -cp java HelloWorldApp
5757
```
5858
59-
Publishing using Apache Maven:
59+
## Publishing using Apache Maven
6060
```yaml
6161
jobs:
6262
build:
@@ -91,7 +91,7 @@ jobs:
9191

9292
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.
9393

94-
Publishing using Gradle:
94+
## Publishing using Gradle
9595
```yaml
9696
jobs:
9797
@@ -118,6 +118,32 @@ jobs:
118118

119119
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.
120120

121+
## Apache Maven within a Shared Runner
122+
123+
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.
124+
125+
```yaml
126+
jobs:
127+
build:
128+
129+
runs-on: ubuntu-latest
130+
131+
steps:
132+
- uses: actions/checkout@v1
133+
- name: Set up JDK 1.8 for Shared Runner
134+
uses: actions/setup-java@v1
135+
with:
136+
java-version: 1.8
137+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
138+
username: ${{ github.actor }} # username for server authentication
139+
password: ${{ github.token }} # password or token for authentication
140+
m2-home: ${{ $GITHUB_WORKSPACE }} # location of the .m2 directory
141+
- name: Build with Maven
142+
run: mvn -B package --file pom.xml
143+
- name: Publish to GitHub Packages Apache Maven
144+
run: mvn deploy
145+
```
146+
121147
# License
122148

123149
The scripts and documentation in this project are released under the [MIT License](LICENSE)

0 commit comments

Comments
 (0)