Quarkiverse Release #6
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. Ex 1.0.0, 1.0.1-RC1, 1.0.2-EA3" | |
required: true | |
default: "1.0.0" | |
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: 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 ${{ github.event.inputs.releaseVersion }} '.[].name|select(. == $RELEASE_VERSION)' releases.json) | |
if [[ ! -z "$release_version_exists" ]]; then | |
echo "Version ${{ github.event.inputs.releaseVersion }} has been previously released. Please change release version." | |
exit 1 | |
else | |
echo "New version: ${{ github.event.inputs.releaseVersion }} going to be released!" | |
fi | |
- name: Add SSH Key for write access for commits | |
uses: kielabokkie/ssh-key-and-known-hosts-action@v1 | |
with: | |
ssh-private-key: ${{ secrets.COMMIT_KEY }} | |
ssh-host: github.com | |
- name: Set Build Params | |
run: | | |
echo "SKIP_FLAGS_ALL_TESTS=-DskipTests=true" >> $GITHUB_ENV | |
if echo "${{github.event.inputs.releaseVersion}}" | grep -iP 'ea|rc'; then | |
NEXT_DEV_REVISION="\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion}" | |
else | |
NEXT_DEV_REVISION="\${next-revision}" | |
fi | |
echo "Calculated Params" | |
echo "NEXT_DEV_REVISION=$NEXT_DEV_REVISION" | |
echo "NEXT_DEV_REVISION=$NEXT_DEV_REVISION" >> $GITHUB_ENV | |
- name: Release Version - Prepare | |
run: >- | |
mvn -B -U validate | |
versions:set-property | |
-Dproperty=revision | |
-DnewVersion="${{ github.event.inputs.releaseVersion }}" && | |
mvn validate | |
versions:set-property | |
-Dproperty=changelist | |
-DnewVersion="" | |
- 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 -B 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/[email protected] | |
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 "[email protected]" | |
git config --local user.name "GitHub Action" | |
- name: Release Version - Checkin | |
run: >- | |
mvn -B validate | |
scm:checkin | |
-DscmVersion=${{ github.event.inputs.sourceBranch }} | |
-DscmVersionType=branch | |
-Dmessage="[ci skip] prepare release ${{ github.event.inputs.releaseVersion }}" && | |
mvn -B scm:tag -Dtag=${{ github.event.inputs.releaseVersion }} | |
- name: GitHub Packages - Deploy Artifacts | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_SECRET }} | |
run: | | |
mvn -B deploy -Dmaven.install.skip=true $SKIP_FLAGS_ALL_TESTS -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 -B deploy -Dmaven.install.skip=true $SKIP_FLAGS_ALL_TESTS -Possrh,publish | |
- name: Create GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
tag: "${{ github.event.inputs.releaseVersion }}" | |
generateReleaseNotes: true | |
makeLatest: true | |
- name: Next Develoment Version - Prepare and Checkin | |
run: >- | |
mvn -B -U validate build-helper:parse-version versions:set-property | |
-Dproperty=revision | |
-DnewVersion='${{ env.NEXT_DEV_REVISION}}' && | |
mvn validate | |
versions:set-property | |
-Dproperty=changelist | |
-DnewVersion="-SNAPSHOT" && | |
mvn validate scm:checkin -B | |
-DscmVersion=${{ github.event.inputs.sourceBranch }} | |
-DscmVersionType=branch | |
-Dmessage="[ci skip] prepare for next development iteration" | |