Release Semantic Stack RQL #15
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: 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-22.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: Setup Git | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Required to have Maven settings.xml set up correctly | |
- name: Set up 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: 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 | |
# Set version in Antora module TODO | |
# 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@9d7c94cfd0a1f3ed45544c887983e9fa900f0564 # v2.0.4 | |
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 }} | |
- 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. |