From 4552b5e6f784071782b30f8f16cc3db4e094a7d2 Mon Sep 17 00:00:00 2001 From: Chris Laprun Date: Mon, 28 Oct 2024 12:28:38 +0100 Subject: [PATCH] chore(ci): update release process according to new Quarkiverse process (#977) * chore(ci): update release process according to new Quarkiverse process Signed-off-by: Chris Laprun * chore(ci): retrieve release version from github environment Signed-off-by: Chris Laprun * chore(ci): remove now obsolete release workflow Signed-off-by: Chris Laprun * fix: deactivate samples when releasing Signed-off-by: Chris Laprun --------- Signed-off-by: Chris Laprun --- .github/workflows/pre-release.yml | 25 ++---- .github/workflows/release-perform.yml | 96 ++++++++++++++++++++ .github/workflows/release-prepare.yml | 18 ++++ .github/workflows/release.yml | 125 -------------------------- pom.xml | 11 +++ 5 files changed, 133 insertions(+), 142 deletions(-) create mode 100644 .github/workflows/release-perform.yml create mode 100644 .github/workflows/release-prepare.yml delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 63d9d0fa1..4bbd7974e 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -5,21 +5,12 @@ on: paths: - '.github/project.yml' -jobs: - release: - runs-on: ubuntu-latest - name: pre release - - steps: - - uses: radcortez/project-metadata-action@master - name: retrieve project metadata - id: metadata - with: - github-token: ${{secrets.GITHUB_TOKEN}} - metadata-file-path: '.github/project.yml' +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true - - name: Validate version - if: contains(steps.metadata.outputs.current-version, 'SNAPSHOT') - run: | - echo '::error::Cannot release a SNAPSHOT version.' - exit 1 \ No newline at end of file +jobs: + pre-release: + name: Pre-Release + uses: quarkiverse/.github/.github/workflows/pre-release.yml@main + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/release-perform.yml b/.github/workflows/release-perform.yml new file mode 100644 index 000000000..d56768f0e --- /dev/null +++ b/.github/workflows/release-perform.yml @@ -0,0 +1,96 @@ +name: Quarkiverse Perform Release +run-name: Perform ${{github.event.inputs.tag || github.ref_name}} Release +on: + push: + tags: + - '*' + workflow_dispatch: + inputs: + tag: + description: 'Tag to release' + required: true + +permissions: + attestations: write + id-token: write + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + perform-release: + name: Perform Release + uses: quarkiverse/.github/.github/workflows/perform-release.yml@main + secrets: inherit + with: + version: ${{github.event.inputs.tag || github.ref_name}} + + prepare-platform-pr: + name: Prepare Platform Update + runs-on: ubuntu-latest + + outputs: + released: ${{steps.wait-for-bom.outputs.published}} + quarkus-platform-branch: ${{steps.versions.outputs.quarkus_platform_branch}} + needs-main-pr: ${{ steps.versions.outputs.needs_main_pr == 'true' }} + + steps: + - uses: actions/checkout@v4 + + - name: Gather versions + id: versions + run: | + echo "quarkus_version=$(./mvnw help:evaluate -Dexpression=quarkus.version -q -DforceStdout)" >> $GITHUB_OUTPUT + quarkus_major=$(echo ${quarkus_version} | cut -d . -f 1,2) + echo "QOSDK-defined Quarkus major version: ${quarkus_major}" + + quarkus_platform_version=$(curl -s https://registry.quarkus.io/client/platforms | jq -r '.platforms[0]."current-stream-id"') + echo "Current platform-defined Quarkus major version: ${quarkus_platform_version}" + + quarkus_platform_branch=main + if [ "${quarkus_major}" = "${quarkus_platform_version}" ]; then + quarkus_platform_branch="${quarkus_platform_version}" + fi + echo "quarkus_platform_branch=${quarkus_platform_branch}" >> $GITHUB_OUTPUT + + if [ "${quarkus_platform_branch}" = "main" ]; then + echo "quarkus-platform update will target main" + echo "need_main_pr=true" >> $GITHUB_OUTPUT + else + echo "quarkus-platform update will target ${quarkus_platform_branch}" + echo "Check if quarkus-platform also needs to be updated on main" + if [ "${{ github.base_ref }}" = "main" ]; then + echo "PR targets main so assume quarkus-platform main also needs to be updated" + echo "need_main_pr=true" >> $GITHUB_OUTPUT + else + echo "No need for PR on quarkus-platform main" + echo "need_main_pr=false" >> $GITHUB_OUTPUT + fi + fi + + - name: Wait for QOSDK BOM to be published + uses: quarkusio/monitor-artifact-publication-action@main + id: wait-for-bom + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + group-id: io.quarkiverse.operatorsdk + artifact-id: quarkus-operator-sdk-bom + version: ${{github.event.inputs.tag || github.ref_name}} + initial-delay: 10 + poll-delay: 2 + poll-iterations: 4 + post-delay: 5 + + update-quarkus-platform: + needs: + - prepare-platform-pr + uses: ./.github/workflows/release-update-quarkus-platform.yml + if: "${{ needs.prepare-platform-pr.outputs.released }}" + with: + qosdk-version: ${{github.event.inputs.tag || github.ref_name}} + quarkus-platform-branch: ${{needs.prepare-platform-pr.outputs.quarkus-platform-branch}} + needs-main-pr: ${{ needs.prepare-platform-pr.outputs.needs-quarkus-platform-main-pr == 'true' }} + secrets: + qosdk-bot-token: ${{ secrets.QOSDK_BOT_TOKEN }} diff --git a/.github/workflows/release-prepare.yml b/.github/workflows/release-prepare.yml new file mode 100644 index 000000000..ec7de1c54 --- /dev/null +++ b/.github/workflows/release-prepare.yml @@ -0,0 +1,18 @@ +name: Quarkiverse Prepare Release + +on: + pull_request: + types: [ closed ] + paths: + - '.github/project.yml' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + prepare-release: + name: Prepare Release + if: ${{ github.event.pull_request.merged == true}} + uses: quarkiverse/.github/.github/workflows/prepare-release.yml@main + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 8b795193e..000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,125 +0,0 @@ -name: Quarkiverse Release - -on: - pull_request: - types: [closed] - paths: - - '.github/project.yml' - -concurrency: - group: "${{ github.workflow }}-${{ github.ref }}" - cancel-in-progress: true - -defaults: - run: - shell: bash - -jobs: - release: - runs-on: ubuntu-latest - name: Release QOSDK - if: ${{github.event.pull_request.merged == true}} - outputs: - released: ${{ steps.wait-for-bom.outputs.published }} - qosdk-version: ${{ steps.metadata.outputs.current-version }} - quarkus-version: ${{ steps.quarkus-version.outputs.quarkus_version }} - quarkus-platform-branch: ${{ steps.release-qosdk.outputs.quarkus_platform_branch }} - needs-quarkus-platform-main-pr: ${{ steps.release-qosdk.outputs.need_main_pr }} - - steps: - - uses: radcortez/project-metadata-action@main - name: Retrieve project metadata - id: metadata - with: - github-token: ${{secrets.GITHUB_TOKEN}} - metadata-file-path: '.github/project.yml' - - - uses: actions/checkout@v4 - - - name: Retrieve Quarkus version - id: quarkus-version - run: echo "quarkus_version=$(./mvnw help:evaluate -Dexpression=quarkus.version -q -DforceStdout)" >> $GITHUB_OUTPUT - - - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 17 - cache: 'maven' - server-id: ossrh - server-username: MAVEN_USERNAME - server-password: MAVEN_PASSWORD - gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} - gpg-passphrase: MAVEN_GPG_PASSPHRASE - - - name: Configure Git author - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - - - name: Maven release ${{steps.metadata.outputs.current-version}} - id: release-qosdk - run: | - quarkus_major=$(echo ${{steps.quarkus-version.outputs.quarkus_version}} | cut -d . -f 1,2) - echo "QOSDK-defined Quarkus major version: ${quarkus_major}" - - quarkus_platform_version=$(curl -s https://registry.quarkus.io/client/platforms | jq -r '.platforms[0]."current-stream-id"') - echo "Current platform-defined Quarkus major version: ${quarkus_platform_version}" - - quarkus_platform_branch=main - if [ "${quarkus_major}" = "${quarkus_platform_version}" ]; then - quarkus_platform_branch="${quarkus_platform_version}" - fi - echo "quarkus_platform_branch=${quarkus_platform_branch}" >> $GITHUB_OUTPUT - - if [ "${quarkus_platform_branch}" = "main" ]; then - echo "quarkus-platform update will target main" - echo "need_main_pr=true" >> $GITHUB_OUTPUT - else - echo "quarkus-platform update will target ${quarkus_platform_branch}" - echo "Check if quarkus-platform also needs to be updated on main" - if [ "${{ github.base_ref }}" = "main" ]; then - echo "PR targets main so assume quarkus-platform main also needs to be updated" - echo "need_main_pr=true" >> $GITHUB_OUTPUT - else - echo "No need for PR on quarkus-platform main" - echo "need_main_pr=false" >> $GITHUB_OUTPUT - fi - fi - - git checkout -b release - ./mvnw -B release:prepare -Prelease -Darguments="-DperformRelease -Dno-samples -DskipTests" -DreleaseVersion=${{steps.metadata.outputs.current-version}} -DdevelopmentVersion=${{steps.metadata.outputs.next-version}} - git checkout ${{github.base_ref}} - git rebase release - ./mvnw -B release:perform -Darguments="-DperformRelease -Dno-samples -DskipTests" -DperformRelease -Prelease - env: - MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - - - name: Wait for QOSDK BOM to be published - uses: quarkusio/monitor-artifact-publication-action@main - id: wait-for-bom - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - group-id: io.quarkiverse.operatorsdk - artifact-id: quarkus-operator-sdk-bom - version: ${{steps.metadata.outputs.current-version}} - initial-delay: 10 - poll-delay: 2 - poll-iterations: 4 - post-delay: 5 - - - name: Push tags - run: git push && git push --tags - - update-quarkus-platform: - needs: - - release - uses: ./.github/workflows/release-update-quarkus-platform.yml - if: "${{ needs.release.outputs.released }}" - with: - qosdk-version: ${{needs.release.outputs.qosdk-version}} - quarkus-platform-branch: ${{needs.release.outputs.quarkus-platform-branch}} - needs-main-pr: ${{ needs.release.outputs.needs-quarkus-platform-main-pr == 'true' }} - secrets: - qosdk-bot-token: ${{ secrets.QOSDK_BOT_TOKEN }} diff --git a/pom.xml b/pom.xml index be6a4975b..51594cd7d 100644 --- a/pom.xml +++ b/pom.xml @@ -96,6 +96,17 @@ samples + + no-samples-in-release + + + !performRelease + + + + samples + + no-docs