Skip to content

Commit d73ee88

Browse files
authored
Merge pull request #17 from sentrysoftware/feature/issue-16-set-up-maven-settingsxml-for-use-in-github-actions
Issue #16: Set up Maven Settings.xml
2 parents 1b2f006 + e1bf779 commit d73ee88

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

.github/workflows/maven-build.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ jobs:
4444
java-version: ${{ inputs.jdkVersion }}
4545
distribution: temurin
4646
cache: maven
47-
47+
48+
- name: Set up Maven settings.xml
49+
uses: s4u/maven-settings-action@v3.0.0
50+
with:
51+
sonatypeSnapshots: true
52+
4853
- name: Setup Node.js ${{ inputs.nodeVersion }}
4954
uses: actions/setup-node@v4
5055
with:

.github/workflows/maven-central-deploy.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ jobs:
4343
java-version: ${{ inputs.jdkVersion }}
4444
distribution: temurin
4545
cache: maven
46-
server-id: ossrh
47-
server-username: OSSRH_USERNAME
48-
server-password: OSSRH_TOKEN
49-
settings-path: ${{ github.workspace }} # location for the settings.xml file
46+
47+
- name: Set up Maven settings.xml
48+
uses: s4u/maven-settings-action@v3.0.0
49+
with:
50+
servers: '[{"id": "ossrh", "username": "${env.OSSRH_USERNAME}", "password": "${env.OSSRH_TOKEN}"}]'
51+
sonatypeSnapshots: true
5052

5153
- name: Setup Node.js ${{ inputs.nodeVersion }}
5254
uses: actions/setup-node@v4
@@ -56,7 +58,7 @@ jobs:
5658
if: ${{ inputs.nodeVersion != '' }}
5759

5860
- name: Build and deploy with Maven
59-
run: mvn -B deploy --file pom.xml -s $GITHUB_WORKSPACE/settings.xml
61+
run: mvn -B deploy --file pom.xml
6062
env:
6163
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
6264
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}

0 commit comments

Comments
 (0)