release #22
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 | |
# description: "On release branch run release:prepare release:perform to publish artificats to maven central" | |
on: | |
workflow_dispatch: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
env: | |
# See https://stackoverflow.com/questions/70153962/nexus-staging-maven-plugin-maven-deploy-failed-an-api-incompatibility-was-enco | |
MAVEN_OPTS: -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED | |
steps: | |
- name: check branch name | |
run: | | |
if [[ ${{ github.ref }} =~ refs/heads/[0-9]+\.[0-9]+-SNAPSHOT ]]; then | |
echo "valid_branch=true" >> $GITHUB_ENV | |
else | |
echo "valid_branch=false" >> $GITHUB_ENV | |
echo "halting release process since this is not a release branch. ${{ github.ref }} must be refs/heads/[0-9]+\.[0-9]+-SNAPSHOT" | |
exit 1 | |
fi | |
- uses: actions/checkout@v4 | |
if: ${{ env.valid_branch }} == 'true' | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
cache: maven | |
server-id: ossrh-release | |
server-username: OSSRH_USERNAME | |
server-password: OSSRH_PASSWORD | |
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }} | |
gpg-passphrase: GPG_SECRET_KEY_PASSPHRASE | |
- name: Release | |
run: | | |
git config --global user.name 'github actions' | |
git config --global user.email '[email protected]' | |
mvn --batch-mode -Darguments=-DskipTests -DpushChanges=false release:prepare | |
git push --atomic -v --follow-tags | |
mvn -Pdeploy --batch-mode -Darguments=-DskipTests release:perform | |
env: | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
GPG_SECRET_KEY_PASSPHRASE: ${{ secrets.GPG_SECRET_KEY_PASSPHRASE }} |