Skip to content

Release Semantic Stack RQL #24

Release Semantic Stack RQL

Release Semantic Stack RQL #24

name: Release Semantic Stack RQL
on:
workflow_dispatch:
inputs:
release_version:
description: 'Version number of the release'
required: true
jobs:
check-preconditions:
name: Check preconditions
runs-on: ubuntu-24.04
steps:
- name: Sanity check version
if: ${{ !contains( github.event.inputs.release_version, '-M' ) }}
run: |
current_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
release_version=${{ github.event.inputs.release_version }}
if [[ $release_version =~ ^[0-9]+.[0-9]+.[0-9]+$ ]]
then
echo version is valid
else
echo release version $release_version is invalid
exit 1
fi
release:
name: Release
needs: [ check-preconditions ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check code style
uses: dbelyaev/action-checkstyle@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-pr-review
checkstyle_config: google_checks.xml
level: warning
fail_on_error: false
# Required to have Maven settings.xml set up correctly
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
server-id: central
server-username: MAVEN_CENTRAL_USERNAME
server-password: MAVEN_CENTRAL_PASSWORD
gpg-private-key: ${{ secrets.PGP_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
cache: 'maven'
overwrite-settings: false
- name: Setup Git
run: |
git config user.name github-actions
git config user.email [email protected]
- name: Set versions
run: |
release_version=${{ github.event.inputs.release_version }}
release_branch_name=${release_version%.*}.x
echo "release_branch_name=$release_branch_name" >> $GITHUB_ENV
# Set version in pom.xml files
mvn -B clean install -DskipTests -Dmaven.javadoc.skip=true
mvn -B versions:set -DnewVersion=${release_version}
mvn -B versions:commit
yq eval -i '.version = "${release_version}"' documentation/antora.yml
git add .
git commit -m "Release version ${release_version}"
- name: Commit version changes and push to upstream repository
uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 # v5
with:
branch: ${{ env.release_branch_name }}
commit_user_name: github-actions
commit_user_email: [email protected]
commit_author: Author <[email protected]>
file_pattern: 'documentation/antora.yml pom.xml */pom.xml */*/pom.xml'
- name: Build and Deploy to Maven Central
run: mvn -B clean deploy -Psign
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.PGP_KEY_PASSWORD }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
# Full release: Github
- name: "Create Github release (full)"
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
with:
body: "Release version ${{ github.event.inputs.release_version }}."
tag_name: v${{ github.event.inputs.release_version }}
target_commitish: ${{ env.release_branch_name }}
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Currently cannot use because the CLA locks closed PRs and the action cannot comment PRs
#- name: "Notify issues of release their fix is contained in"
# uses: apexskier/github-release-commenter@3bd413ad5e1d603bfe2282f9f06f2bdcec079327 # v1.3.6
# with:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# comment-template: |
# Release {release_link} addresses this.