Skip to content

Commit

Permalink
Added the nexus staging plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
tishun committed Jun 11, 2024
1 parent 1318fa9 commit 9f1ca1c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
24 changes: 10 additions & 14 deletions .github/workflows/version-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: 1. Checkout sources
- name: Checkout sources
uses: actions/checkout@v4

- name: 2. Extract version from tag
id: get_version
run: |
realversion="${GITHUB_REF/refs\/tags\//}"
realversion="${realversion//v/}"
echo "VERSION=$realversion" >> $GITHUB_OUTPUT
- name: 3. Set up Java with Maven cache
- name: Set up Java with Maven cache
uses: actions/setup-java@v4
with:
java-version: '8'
Expand All @@ -30,20 +23,23 @@ jobs:
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: 4. Update version in Maven configuration
run: mvn versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION }}
- name: Update version in Maven configuration
run: |
mvn --no-transfer-progress \
--batch-mode \
versions:set -DnewVersion=${{ github.event.release.tag_name }}
- name: 5. Install GPG key
- name: Install GPG key
run: |
cat <(echo -e "${{ secrets.OSSH_GPG_SECRET_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- name: 6. Publish to Maven
- name: Publish to Maven
run: |
mvn --no-transfer-progress \
--batch-mode \
-Dgpg.passphrase='${{ secrets.OSSH_GPG_SECRET_KEY_PASSWORD }}' \
release:perform
deploy -P sonatype-oss-release
env:
MAVEN_USERNAME: ${{secrets.OSSH_USERNAME}}
MAVEN_PASSWORD: ${{secrets.OSSH_TOKEN}}
12 changes: 12 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,18 @@
<version>3.0.1</version>
</plugin>

<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down

0 comments on commit 9f1ca1c

Please sign in to comment.