Skip to content

Commit c05b45b

Browse files
author
Bryan Clark
committed
Update README with env sections
1 parent 7e36086 commit c05b45b

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,28 +69,28 @@ jobs:
6969
uses: actions/setup-java@v1
7070
with:
7171
java-version: 1.8
72-
env:
73-
GITHUB_TOKEN: ${{ github.token }}
7472

7573
- name: Build with Maven
7674
run: mvn -B package --file pom.xml
7775

7876
- name: Publish to GitHub Packages Apache Maven
7977
run: mvn deploy
78+
env:
79+
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password
8080

8181
- name: Set up Apache Maven Central
8282
uses: actions/setup-java@v1
8383
with: # running setup-java again overwrites the settings.xml
8484
java-version: 1.8
8585
server-id: maven # Value of the distributionManagement/repository/id field of the pom.xml
86-
server-username: MAVEN_USERNAME # env variable for username below
87-
server-password: MAVEN_CENTRAL_TOKEN # env variable for token below
88-
env:
89-
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
90-
MAVEN_USERNAME: maven_username123
86+
server-username: MAVEN_USERNAME # env variable for username in deploy
87+
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
9188

9289
- name: Publish to Apache Maven Central
9390
run: mvn deploy
91+
env:
92+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
93+
MAVEN_USERNAME: maven_username123
9494
```
9595
9696
***NOTE: The `settings.xml` file is created in the Actions $HOME directory. If you have an existing `settings.xml` file at that location, it will be overwritten. See below for using the `settings-path` to change your `settings.xml` file location.***
@@ -142,14 +142,14 @@ jobs:
142142
java-version: 1.8
143143
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
144144
settings-path: ${{ github.workspace }} # location for the settings.xml file
145-
env:
146-
GITHUB_TOKEN: ${{ github.token }}
147145
148146
- name: Build with Maven
149147
run: mvn -B package --file pom.xml
150148
151149
- name: Publish to GitHub Packages Apache Maven
152150
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
151+
env:
152+
GITHUB_TOKEN: ${{ github.token }}
153153
```
154154

155155
# License

src/setup-java.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ async function run() {
1919
console.log(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
2020

2121
const id = core.getInput('server-id', {required: false}) || undefined;
22-
const username = core.getInput('server-username', {required: false}) || undefined;
23-
const password = core.getInput('server-password', {required: false}) || undefined;
22+
const username =
23+
core.getInput('server-username', {required: false}) || undefined;
24+
const password =
25+
core.getInput('server-password', {required: false}) || undefined;
2426

2527
await auth.configAuthentication(id, username, password);
2628
} catch (error) {

0 commit comments

Comments
 (0)