From c05b45bb9156e7a0d3ed6a39e72b1debd3d0a780 Mon Sep 17 00:00:00 2001 From: Bryan Clark Date: Thu, 19 Dec 2019 15:39:48 -0800 Subject: [PATCH] Update README with env sections --- README.md | 18 +++++++++--------- src/setup-java.ts | 6 ++++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 977a4bb..9a1915a 100644 --- a/README.md +++ b/README.md @@ -69,28 +69,28 @@ jobs: uses: actions/setup-java@v1 with: java-version: 1.8 - env: - GITHUB_TOKEN: ${{ github.token }} - name: Build with Maven run: mvn -B package --file pom.xml - name: Publish to GitHub Packages Apache Maven run: mvn deploy + env: + GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password - name: Set up Apache Maven Central uses: actions/setup-java@v1 with: # running setup-java again overwrites the settings.xml java-version: 1.8 server-id: maven # Value of the distributionManagement/repository/id field of the pom.xml - server-username: MAVEN_USERNAME # env variable for username below - server-password: MAVEN_CENTRAL_TOKEN # env variable for token below - env: - MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} - MAVEN_USERNAME: maven_username123 + server-username: MAVEN_USERNAME # env variable for username in deploy + server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy - name: Publish to Apache Maven Central run: mvn deploy + env: + MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} + MAVEN_USERNAME: maven_username123 ``` ***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: java-version: 1.8 server-id: github # Value of the distributionManagement/repository/id field of the pom.xml settings-path: ${{ github.workspace }} # location for the settings.xml file - env: - GITHUB_TOKEN: ${{ github.token }} - name: Build with Maven run: mvn -B package --file pom.xml - name: Publish to GitHub Packages Apache Maven run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml + env: + GITHUB_TOKEN: ${{ github.token }} ``` # License diff --git a/src/setup-java.ts b/src/setup-java.ts index 7614f03..d039217 100644 --- a/src/setup-java.ts +++ b/src/setup-java.ts @@ -19,8 +19,10 @@ async function run() { console.log(`##[add-matcher]${path.join(matchersPath, 'java.json')}`); const id = core.getInput('server-id', {required: false}) || undefined; - const username = core.getInput('server-username', {required: false}) || undefined; - const password = core.getInput('server-password', {required: false}) || undefined; + const username = + core.getInput('server-username', {required: false}) || undefined; + const password = + core.getInput('server-password', {required: false}) || undefined; await auth.configAuthentication(id, username, password); } catch (error) {