Release artifacts #5
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: Maven release | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseVersion: | |
description: "Release version." | |
required: true | |
default: "X.Y.Z" | |
developmentVersion: | |
description: "Version to which working copy should be set after release." | |
required: true | |
default: "X.Y.Z-SNAPSHOT" | |
dryRun: | |
description: "Should release be done in dry-run mode." | |
required: true | |
default: "true" | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup git | |
run: | | |
git config user.email "ci@connectorio.com" | |
git config user.name "ConnectorIO Bot" | |
git config --global url."https://${BUILD_USER}:${BUILD_TOKEN}@github.com/".insteadOf "git@github.com:" | |
env: | |
BUILD_USER: x-access-token | |
BUILD_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
server-id: sonatype-nexus-staging | |
server-username: CI_RELEASE_USERNAME | |
server-password: CI_RELEASE_PASSWORD | |
gpg-passphrase: GPG_PASSPHRASE | |
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
- name: Cache local Maven repository | |
uses: actions/cache@v3 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Dump env | |
run: >- | |
env && cat ~/.m2/settings.xml | |
env: | |
CI_RELEASE_USERNAME: ${{ secrets.CI_RELEASE_USERNAME }} | |
CI_RELEASE_PASSWORD: ${{ secrets.CI_RELEASE_PASSWORD }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Maven Prepare Release | |
run: >- | |
mvn -B | |
release:prepare -DpreparationProfiles=release,connectorio | |
-DreleaseVersion=${{ inputs.releaseVersion }} | |
-DdevelopmentVersion=${{ inputs.developmentVersion }} | |
-DdryRun=${{ inputs.dryRun }} | |
- name: Maven Perform Release | |
if: success() | |
run: >- | |
mvn -B | |
release:perform -DreleaseProfiles=release,connectorio | |
env: | |
CI_RELEASE_USERNAME: ${{ secrets.CI_RELEASE_USERNAME }} | |
CI_RELEASE_PASSWORD: ${{ secrets.CI_RELEASE_PASSWORD }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Rollback on failure | |
if: failure() | |
run: | | |
mvn -B release:rollback | |
echo "You may need to manually delete the git tag, if it was created." |