Skip to content

Commit

Permalink
Fixed the release flow (6.4.x branch) (#2897)
Browse files Browse the repository at this point in the history
* Modify the release acrtion to call the proper maven target for release, make releasing manually available too (#2885)

* Added the nexus staging plugin

* Make version step conditional on the availability of a tag name in the event

* Missed the GPG configuration
  • Loading branch information
tishun committed Jun 23, 2024
1 parent 1318fa9 commit 06cb84a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
27 changes: 14 additions & 13 deletions .github/workflows/version-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,11 @@ 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: Set up Java with Maven cache

- name: 3. Set up Java with Maven cache
uses: actions/setup-java@v4
with:
java-version: '8'
Expand All @@ -30,20 +24,27 @@ 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 }}
if: ${{ github.event.release.tag_name }}

- name: Install GPG key

- name: 5. 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}}
18 changes: 18 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,18 @@
</configuration>
</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-source-plugin</artifactId>
Expand Down Expand Up @@ -1019,6 +1031,12 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
Expand Down

0 comments on commit 06cb84a

Please sign in to comment.