Release Semantic Stack RQL #41
This file contains hidden or 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-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 ] | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7 | |
| # Required to have Maven settings.xml set up correctly | |
| - name: Setup JDK 25 | |
| uses: actions/setup-java@1bcf9fb12cf4aa7d266a90ae39939e61372fe520 # v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '25' | |
| 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: Cache Maven packages | |
| uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-maven- | |
| - name: Cache SonarQube packages | |
| uses: actions/cache@caa296126883cff596d87d8935842f9db880ef25 # v5 | |
| with: | |
| path: ~/.sonar/cache | |
| key: ${{ runner.os }}-sonar | |
| restore-keys: ${{ runner.os }}-sonar | |
| - 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: Push release branch to upstream repository | |
| run: | | |
| git push origin HEAD:refs/heads/${{ env.release_branch_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and Deploy to Maven Central | |
| run: mvn -B clean deploy org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Psign | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| 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)" | |
| run: | | |
| gh release create "v${{ github.event.inputs.release_version }}" \ | |
| --target "${{ env.release_branch_name }}" \ | |
| --title "v${{ github.event.inputs.release_version }}" \ | |
| --generate-notes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |