Skip to content

Commit

Permalink
Merge pull request #455 from Ladicek/new-release-workflow
Browse files Browse the repository at this point in the history
Use new release workflow with common SmallRye release actions
  • Loading branch information
Ladicek authored Oct 23, 2024
2 parents f88af00 + 545f8b8 commit 1ef21e0
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 78 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Jandex Prepare Release

run-name: Prepare ${{github.event.inputs.tag || github.ref_name}} Release

on:
pull_request:
types:
- closed
paths:
- '.github/project.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
before-release:
name: Before release
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.merged == true}}

steps:
- name: Before release
run: |
java -version
mvn --version
git config --global user.name "SmallRye CI"
git config --global user.email "[email protected]"
sed -i -e 's|<version.jandex>.*</version.jandex>|<version.jandex>${{steps.metadata.outputs.current-version}}</version.jandex>|' benchmarks/pom.xml
sed -i -e 's|^version: main|version: ${{steps.metadata.outputs.current-version}}|' doc/antora.yml
git add -A .
git commit -a -m 'Amendments before release'
git push
prepare-release:
name: Prepare release
needs: before-release
if: ${{ github.event.pull_request.merged == true}}

uses: smallrye/.github/.github/workflows/prepare-release.yml@main
secrets: inherit

after-release:
name: After release
runs-on: ubuntu-latest
needs: prepare-release
if: ${{ github.event.pull_request.merged == true}}

steps:
- name: After release
run: |
git config --global user.name "SmallRye CI"
git config --global user.email "[email protected]"
sed -i -e 's|<version.jandex>.*</version.jandex>|<version.jandex>${project.version}</version.jandex>|' benchmarks/pom.xml
sed -i -e 's|^version: ${{steps.metadata.outputs.current-version}}|version: main|' doc/antora.yml
git add -A .
git commit -a -m 'Amendments after release'
git push
102 changes: 27 additions & 75 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,85 +1,37 @@
name: Jandex Release

on:
pull_request:
types:
- closed
paths:
- '.github/project.yml'

jobs:
release:
name: Release
runs-on: ubuntu-latest
if: ${{github.event.pull_request.merged == true}}
env:
GITHUB_TOKEN: ${{secrets.RELEASE_TOKEN}}

steps:
- name: Retrieve project metadata
id: metadata
uses: radcortez/project-metadata-action@main
with:
github-token: ${{secrets.GITHUB_TOKEN}}
metadata-file-path: '.github/project.yml'

- name: Checkout
uses: actions/checkout@v4
with:
token: ${{secrets.RELEASE_TOKEN}}
run-name: Perform ${{github.event.inputs.tag || github.ref_name}} Release

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
server-id: 'oss.sonatype'
server-username: 'MAVEN_DEPLOY_USERNAME'
server-password: 'MAVEN_DEPLOY_TOKEN'
gpg-private-key: ${{secrets.MAVEN_GPG_PRIVATE_KEY}}
gpg-passphrase: 'MAVEN_GPG_PASSPHRASE'
on:
push:
tags:
- '*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to release'
required: true

- name: Set up Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: 3.8.7
permissions:
attestations: write
id-token: write
contents: write

- name: Maven release ${{steps.metadata.outputs.current-version}}
env:
MAVEN_DEPLOY_USERNAME: ${{secrets.MAVEN_DEPLOY_USERNAME}}
MAVEN_DEPLOY_TOKEN: ${{secrets.MAVEN_DEPLOY_TOKEN}}
MAVEN_GPG_PASSPHRASE: ${{secrets.MAVEN_GPG_PASSPHRASE}}
run: |
export MAVEN_OPTS="--add-opens=java.base/java.util=ALL-UNNAMED"
java -version
mvn --version
git config --global user.name "SmallRye CI"
git config --global user.email "[email protected]"
git checkout -b release
sed -i -e 's|<version.jandex>.*</version.jandex>|<version.jandex>${{steps.metadata.outputs.current-version}}</version.jandex>|' benchmarks/pom.xml
sed -i -e 's|^version: main|version: ${{steps.metadata.outputs.current-version}}|' doc/antora.yml
git commit -a -m 'Amendments before release'
mvn -B release:prepare -Prelease -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}}
git checkout ${{github.base_ref}}
git rebase release
mvn -B release:perform -Prelease
sed -i -e 's|<version.jandex>.*</version.jandex>|<version.jandex>${project.version}</version.jandex>|' benchmarks/pom.xml
sed -i -e 's|^version: ${{steps.metadata.outputs.current-version}}|version: main|' doc/antora.yml
git commit -a -m 'Amendments after release'
git push
git push --tags
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

- name: Milestone release
uses: radcortez/milestone-release-action@main
with:
github-token: ${{secrets.GITHUB_TOKEN}}
milestone-title: ${{steps.metadata.outputs.current-version}}
milestone-next: ${{steps.metadata.outputs.next-version}}
jobs:
perform-release:
name: Perform Release
uses: smallrye/.github/.github/workflows/perform-release.yml@main
secrets: inherit
with:
version: ${{github.event.inputs.tag || github.ref_name}}

github-pages:
name: GitHub Pages
needs:
- release
needs: perform-release
runs-on: ubuntu-latest

steps:
Expand All @@ -96,12 +48,12 @@ jobs:
- name: Generate and push
run: |
node --version
curl -s -L -o antora-playbook.yml https://github.com/smallrye/jandex/blob/main/doc/antora-playbook-prod.yml?raw=true
npm install @antora/[email protected] @antora/[email protected]
npx antora generate antora-playbook.yml
rm -rf node_modules docs package.json package-lock.json antora-playbook.yml
mv -T build/site docs
touch docs/.nojekyll
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: Jandex Pre-Release
name: Jandex Review Release

run-name: Review ${{github.event.inputs.tag || github.ref_name}} Release

on:
pull_request:
paths:
- '.github/project.yml'

jobs:
release:
name: Pre-release checks
review-release:
name: Review release
runs-on: ubuntu-latest

steps:
Expand Down

0 comments on commit 1ef21e0

Please sign in to comment.