Skip to content

Commit

Permalink
Configure GitHub Release to Maven Central
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
oranheim committed Sep 27, 2024
1 parent 899c852 commit 1e8b75f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/manual-github-release-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,32 @@ jobs:
git config user.email "[email protected]"
git config user.name "GitHub Actions"
- name: Import and Verify GPG key
- name: Import GPG key
env:
GPG_PRIVATE_KEY: ${{ secrets.OSSRH_GPG_PRIVATE_KEY }}
GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
GPG_KEY_ID: ${{ secrets.OSSRH_GPG_SECRET_KEY_ID }}
GPG_SECRET: ${{ secrets.GPG_SECRET }}
run: |
echo "$GPG_PRIVATE_KEY" | gpg --batch --import
echo "$GPG_SECRET" | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
echo "Verifying GPG passphrase..."
echo "test" | gpg --batch --yes --passphrase "$GPG_PASSPHRASE" --local-user "$GPG_KEY_ID" --armor --detach-sign --pinentry-mode loopback
- name: Release with Maven
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USER }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
GPG_KEY_ID: ${{ secrets.OSSRH_GPG_SECRET_KEY_ID }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
run: |
mvn -X --batch-mode release:clean release:prepare release:perform \
-Darguments="-Dgpg.passphrase=${GPG_PASSPHRASE} -Dgpg.keyname=${GPG_KEY_ID} -DskipTests" \
-Dgpg.passphrase=${GPG_PASSPHRASE} \
-Dgpg.keyname=${GPG_KEY_ID} \
-DskipTests \
-P oss-maven-central
- name: Cleanup GPG keys
if: always()
run: |
gpg --delete-secret-keys ${{ secrets.GPG_KEY_ID }}
gpg --delete-keys ${{ secrets.GPG_KEY_ID }}
- name: Notify on success
if: success()
run: |
Expand Down
1 change: 0 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@
</execution>
</executions>
<configuration>
<!-- This is necessary for gpg to not try to use the pinentry programs -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
Expand Down

0 comments on commit 1e8b75f

Please sign in to comment.