Skip to content

Release Semantic Stack RQL #8

Release Semantic Stack RQL

Release Semantic Stack RQL #8

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-20.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
# 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
continue-on-error: true
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=${{ github.event.inputs.release_version }}
mvn -B versions:commit
# Set version in Antora module TODO
# yq eval -i '.version = "${{ github.event.inputs.release_version }}"' documentation/developer-guide/antora.yml
- 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 }}
- name: Commit version changes and push to upstream repository
uses: stefanzweifel/git-auto-commit-action@8756aa072ef5b4a080af5dc8fef36c5d586e521d # 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/developer-guide/antora.yml pom.xml */pom.xml */*/pom.xml'
# Full release: Github
- name: "Create Github release (full)"
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
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
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.