Skip to content

Release Build

Release Build #4

Workflow file for this run

---
name: Release Build
on:
release:
types:
- published
env:
# renovate: datasource=java-version depName=java-jdk
JAVA_VERSION: '17.0.8+7'
# renovate: datasource=maven depName=org.apache.maven:maven
MAVEN_VERSION: '3.9.4'
jobs:
build:
runs-on: ubuntu-latest
environment: Release
permissions:
contents: read
packages: write
if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3
- name: Set up Maven
uses: stCarolas/setup-maven@07fbbe97d97ef44336b7382563d66743297e442f # v4.5
with:
maven-version: ${{ env.MAVEN_VERSION }}
- name: Set up Java
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Deploy Release to GitHub Packages
run: mvn --batch-mode --no-transfer-progress -Drevision=${GITHUB_REF_NAME##v} -Dtag=${{ github.ref_name }} -Dtree=${{ github.ref_name }} deploy -P release,github
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Set up Java for Maven Central
uses: actions/setup-java@cd89f46ac9d01407894225f350157564c9c7cee2 # v3
with: # running setup-java again overwrites the settings.xml
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Deploy Release to Maven Central
run: mvn --batch-mode --no-transfer-progress -Drevision=${GITHUB_REF_NAME##v} -Dtag=${{ github.ref_name }} -Dtree=${{ github.ref_name }} deploy -P release,ossrh
env:
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}