From 545f8b8e36e4c71c95629c0010e2d1b521649a10 Mon Sep 17 00:00:00 2001 From: Ladislav Thon Date: Wed, 23 Oct 2024 11:18:18 +0200 Subject: [PATCH] Use new release workflow with common SmallRye release actions --- .github/workflows/prepare-release.yml | 58 ++++++++++ .github/workflows/release.yml | 102 +++++------------- .../{pre-release.yml => review-release.yml} | 8 +- 3 files changed, 90 insertions(+), 78 deletions(-) create mode 100644 .github/workflows/prepare-release.yml rename .github/workflows/{pre-release.yml => review-release.yml} (83%) diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 00000000..558ce995 --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -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 "smallrye@googlegroups.com" + sed -i -e 's|.*|${{steps.metadata.outputs.current-version}}|' 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 "smallrye@googlegroups.com" + sed -i -e 's|.*|${project.version}|' 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index eac51600..eac7c817 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 "smallrye@googlegroups.com" - git checkout -b release - sed -i -e 's|.*|${{steps.metadata.outputs.current-version}}|' 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|.*|${project.version}|' 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: @@ -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/cli@3.0 @antora/site-generator-default@3.0 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 diff --git a/.github/workflows/pre-release.yml b/.github/workflows/review-release.yml similarity index 83% rename from .github/workflows/pre-release.yml rename to .github/workflows/review-release.yml index 7978525a..61dc7f85 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/review-release.yml @@ -1,4 +1,6 @@ -name: Jandex Pre-Release +name: Jandex Review Release + +run-name: Review ${{github.event.inputs.tag || github.ref_name}} Release on: pull_request: @@ -6,8 +8,8 @@ on: - '.github/project.yml' jobs: - release: - name: Pre-release checks + review-release: + name: Review release runs-on: ubuntu-latest steps: