Quarkiverse Release #1
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: Quarkiverse Release | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseVersion: | |
description: "Version to use when preparing a release. Use `auto` to use the latest version from the pom.xml." | |
required: true | |
default: "auto" | |
sourceBranch: | |
description: "Which branch contains the previous release version." | |
default: "main" | |
concurrency: | |
group: "quarkiverse-release" | |
cancel-in-progress: false | |
defaults: | |
run: | |
shell: bash | |
permissions: | |
contents: write | |
packages: write | |
checks: write | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
name: release | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.sourceBranch }} | |
- name: Import GPG key | |
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 #v6.1.0 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.GPG_SECRET }} | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: temurin | |
java-version: 11 | |
cache: 'maven' | |
server-id: github | |
gpg-passphrase: GPG_PASSPHRASE | |
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} | |
- name: Find version to use | |
id: version | |
run: | | |
if [[ "${{ github.event.inputs.releaseVersion }}" -eq "auto" ]]; then | |
echo "No release version provided, using the latest version from the pom.xml" | |
new_version=`mvn -B help:evaluate -Dexpression=project.version -q -DforceStdout | sed -e 's/-SNAPSHOT$//'` | |
echo "New version will be $new_version" | |
echo version=$new_version >> $GITHUB_OUTPUT | |
else | |
echo version=${{ github.event.inputs.releaseVersion }} >> $GITHUB_OUTPUT | |
fi | |
- name: Pre-Release Check - Version | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh api --method GET /repos/${{github.repository}}/releases -f sort=updated -f direction=asc > releases.json | |
release_version_exists=$(jq -r --arg RELEASE_VERSION ${{ steps.version.outputs.version }} '.[].name|select(.|test($RELEASE_VERSION))' releases.json) | |
if [[ ! -z "$release_version_exists" ]]; then | |
echo "Version ${{ steps.version.outputs.version }} has been previously released. Please change release version." | |
exit 1 | |
else | |
echo "New version: ${{ steps.version.outputs.version }} going to be released!" | |
fi | |
- name: Release Version - Prepare | |
run: >- | |
mvn -B -U versions:set | |
-DnewVersion=${{ steps.version.outputs.version }} | |
-DprocessAllModules | |
-DgenerateBackupPoms=false | |
- name: Update latest release version in docs | |
run: | | |
mvn -B -ntp -pl docs -am generate-resources -Denforcer.skip -Dformatter.skip -Dimpsort.skip | |
if ! git diff --quiet docs/modules/ROOT/pages/includes/attributes.adoc; then | |
git add docs/modules/ROOT/pages/includes/attributes.adoc | |
fi | |
- name: Verify Maven | |
run: mvn verify | |
- name: Publishing Test Results - Unit/Integration Tests Pre-Condition | |
if: always() | |
id: unit_integration_test_report_exists | |
uses: andstor/file-existence-action@v2 | |
with: | |
files: "**/surefire-reports/**/TEST*.xml" | |
- name: Publishing Test Results - Unit/Integration Tests | |
uses: dorny/test-reporter@v1.7.0 | |
if: always() && steps.unit_integration_test_report_exists.outputs.files_exists == 'true' | |
with: | |
name: Test Results | |
path: "**/surefire-reports/**/TEST*.xml" | |
fail-on-error: 'false' | |
reporter: java-junit | |
only-summary: 'true' | |
- name: Configure Git author | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
- name: Release Version - Checkin | |
run: >- | |
mvn validate | |
scm:checkin | |
-DscmVersion=${{ github.event.inputs.sourceBranch }} | |
-DscmVersionType=branch | |
-Dmessage="[ci skip] prepare release ${{ steps.version.outputs.version }}" && | |
mvn scm:tag -Dtag=${{ steps.version.outputs.version }} | |
- name: GitHub Packages - Deploy Artifacts | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_SECRET }} | |
run: | | |
mvn deploy -Dmaven.install.skip=true -Pgithub,publish | |
- name: maven-settings-xml-action | |
uses: whelk-io/maven-settings-xml-action@v4 | |
with: | |
servers: '[{ "id": "ossrh", "username": "${{ secrets.OSSRH_USER }}", "password": "${{ secrets.OSSRH_PASS }}" }]' | |
- name: Maven Central - Deploy Artifacts | |
env: | |
GPG_PASSPHRASE: ${{ secrets.GPG_SECRET }} | |
run: | | |
mvn deploy -Dmaven.install.skip=true -Possrh,publish | |
- name: Create GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: "${{ steps.version.outputs.version }}" | |
generateReleaseNotes: true | |
makeLatest: true | |
- name: Next Develoment Version - Prepare and Checkin | |
run: >- | |
mvn -B -U build-helper:parse-version versions:set | |
-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT | |
-DprocessAllModules | |
-DgenerateBackupPoms=false && | |
mvn validate scm:checkin | |
-DscmVersion=${{ github.event.inputs.sourceBranch }} | |
-DscmVersionType=branch | |
-Dmessage="[ci skip] prepare for next development iteration" | |