Skip to content

Commit

Permalink
Replace s4u/maven-settings-action with simple ci/mvnsettings.xml file
Browse files Browse the repository at this point in the history
 - action was unable to set server with only id and passphrase ("servers must contain id, and username or configuration")
  • Loading branch information
eschleb committed Oct 2, 2024
1 parent 5e2bb14 commit 9951958
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 42 deletions.
43 changes: 11 additions & 32 deletions .github/workflows/release-and-deploy-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ on:

jobs:
release:

runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -19,17 +17,11 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 17
- name: Maven setup
uses: s4u/[email protected]
with:
servers: |
[{
"id": "magnolia.enterprise.group",
"username": "${{secrets.MGNL_NEXUS_USER}}",
"password": "${{secrets.MGNL_NEXUS_PASS}}"
}]
- name: Maven verify
run: mvn verify --batch-mode
run: mvn -s ci/mvnsettings.xml verify --batch-mode
env:
MAGNOLIA_REPO_USER: ${{ secrets.MGNL_NEXUS_USER }}
MAGNOLIA_REPO_PASSWORD: ${{ secrets.MGNL_NEXUS_PASS }}
# Install xmllint
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install libxml2-utils
Expand All @@ -45,7 +37,6 @@ jobs:
ci/mvn-release.sh
deploy-release:

needs: release
runs-on: ubuntu-latest

Expand All @@ -60,23 +51,11 @@ jobs:
distribution: temurin
java-version: 17
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Maven setup
uses: s4u/[email protected]
with:
servers: |
[{
"id": "magnolia.enterprise.group",
"username": "${{secrets.MGNL_NEXUS_USER}}",
"password": "${{secrets.MGNL_NEXUS_PASS}}"
},
{
"id": "central",
"username": "${{secrets.SONATYPE_USER}}",
"password": "${{secrets.SONATYPE_PASSWORD}}"
},
{
"id": "gpg.passphrase",
"passphrase": "${{secrets.GPG_PASSPHRASE}}"
}]
- name: Release Maven package
run: mvn deploy -Pdeploy
run: mvn -s ci/mvnsettings.xml deploy -Pdeploy
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USER }}
MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
MAGNOLIA_REPO_USER: ${{ secrets.MGNL_NEXUS_USER }}
MAGNOLIA_REPO_PASSWORD: ${{ secrets.MGNL_NEXUS_PASS }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
14 changes: 4 additions & 10 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,8 @@ jobs:
with:
distribution: temurin
java-version: 17
- name: Maven setup
uses: s4u/[email protected]
with:
servers: |
[{
"id": "magnolia.enterprise.group",
"username": "${{secrets.MGNL_NEXUS_USER}}",
"password": "${{secrets.MGNL_NEXUS_PASS}}"
}]
- name: Maven verify
run: mvn verify --batch-mode
run: mvn -s ci/mvnsettings.xml verify --batch-mode
env:
MAGNOLIA_REPO_USER: ${{ secrets.MGNL_NEXUS_USER }}
MAGNOLIA_REPO_PASSWORD: ${{ secrets.MGNL_NEXUS_PASS }}
22 changes: 22 additions & 0 deletions ci/mvnsettings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<!-- Magnolia Repositories -->
<server>
<id>magnolia.enterprise.group</id>
<username>${env.MAGNOLIA_REPO_USER}</username>
<password>${env.MAGNOLIA_REPO_PASSWORD}</password>
</server>
<server>
<id>central</id>
<username>${env.MAVEN_USERNAME}</username>
<password>${env.MAVEN_PASSWORD}</password>
</server>
<server>
<!-- https://maven.apache.org/plugins/maven-gpg-plugin/usage.html#configure-passphrase-in-settings-xml -->
<id>gpg.passphrase</id>
<passphrase>${env.MAVEN_GPG_PASSPHRASE}</passphrase>
</server>
</servers>
</settings>

0 comments on commit 9951958

Please sign in to comment.