Release to maven central #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release to maven central | |
on: | |
workflow_dispatch: | |
jobs: | |
release: | |
if: github.event.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- run: | | |
git config --global user.name 'eclipse-uprotocol-bot' | |
git config --global user.email 'uprotocol-bot@eclipse.org' | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.BOT_GITHUB_TOKEN }} | |
- name: Set up Apache Maven Central | |
uses: actions/setup-java@v3 | |
with: # configure settings.xml | |
distribution: 'temurin' | |
java-version: '11' | |
server-id: ossrh | |
server-username: OSSRH_USER | |
server-password: OSSRH_PASSWORD | |
gpg-private-key: ${{ secrets.ORG_GPG_PRIVATE_KEY }} | |
gpg-passphrase: GPG_PASSPHRASE | |
- name: Stage to Nexus and Release to Maven central | |
run: | | |
mvn -B release:clean release:prepare -P release release:perform | |
env: | |
OSSRH_USER: ${{ secrets.ORG_OSSRH_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }} | |
GPG_PASSPHRASE: ${{ secrets.ORG_GPG_PASSPHRASE }} | |
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} | |
- if: cancelled() || failure() | |
run: | | |
mvn -B release:rollback | |
env: | |
GH_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }} |