From 3b9f9b4374531f9839b70c3197cfd59b52d03e48 Mon Sep 17 00:00:00 2001 From: xstefank Date: Mon, 20 Jan 2025 08:17:54 +0100 Subject: [PATCH] chore: move Quarkus platform PR info to the project.yml file Signed-off-by: xstefank --- .github/project.yml | 4 +- .../workflows/release-quarkus-platform-pr.yml | 16 ++--- .../release-update-quarkus-platform.yml | 58 +++++-------------- 3 files changed, 25 insertions(+), 53 deletions(-) diff --git a/.github/project.yml b/.github/project.yml index bc881fae3..1c14b5d1d 100644 --- a/.github/project.yml +++ b/.github/project.yml @@ -2,4 +2,6 @@ name: Java Operator SDK Extension release: current-version: 7.0.0.CR1 next-version: 7.0.0-SNAPSHOT - + quarkus-platform-branches: + - "main" + - "3.17" diff --git a/.github/workflows/release-quarkus-platform-pr.yml b/.github/workflows/release-quarkus-platform-pr.yml index cdc26bd40..3b343dff5 100644 --- a/.github/workflows/release-quarkus-platform-pr.yml +++ b/.github/workflows/release-quarkus-platform-pr.yml @@ -6,10 +6,9 @@ on: qosdk-version: type: string required: true - quarkus-platform-branch: + quarkus-platform-branches: type: string - required: false - default: 'main' + required: true secrets: qosdk-bot-token: required: true @@ -17,11 +16,14 @@ on: jobs: quarkus-platform-pr: runs-on: ubuntu-latest + strategy: + matrix: + quarkus-platform-branch: ${{ fromJson(inputs.quarkus-platform-branches) }} steps: - uses: actions/checkout@v4 with: repository: quarkusio/quarkus-platform - ref: ${{inputs.quarkus-platform-branch}} + ref: ${{matrix.quarkus-platform-branch}} - uses: actions/setup-java@v4 with: @@ -29,7 +31,7 @@ jobs: java-version: 17 cache: 'maven' - - name: Update QOSDK version to ${{inputs.qosdk-version}} in quarkus-platform ${{inputs.quarkus-platform-branch}} + - name: Update QOSDK version to ${{inputs.qosdk-version}} in quarkus-platform ${{matrix.quarkus-platform-branch}} run: | ./mvnw -B versions:set-property -Dproperty=quarkus-operator-sdk.version -DnewVersion=${{inputs.qosdk-version}} ./mvnw -Dsync @@ -38,11 +40,11 @@ jobs: uses: peter-evans/create-pull-request@v7 id: qp-pr with: - title: "Update QOSDK to ${{inputs.qosdk-version}} for ${{inputs.quarkus-platform-branch}}" + title: "Update QOSDK to ${{inputs.qosdk-version}} for ${{matrix.quarkus-platform-branch}}" commit-message: "Update QOSDK to ${{inputs.qosdk-version}}" committer: metacosm author: metacosm - branch: qosdk-release-${{inputs.qosdk-version}}-${{inputs.quarkus-platform-branch}} + branch: qosdk-release-${{inputs.qosdk-version}}-${{matrix.quarkus-platform-branch}} token: ${{ secrets.qosdk-bot-token }} push-to-fork: qosdk-bot/quarkus-platform delete-branch: true diff --git a/.github/workflows/release-update-quarkus-platform.yml b/.github/workflows/release-update-quarkus-platform.yml index 6597fef2b..807f0ddf6 100644 --- a/.github/workflows/release-update-quarkus-platform.yml +++ b/.github/workflows/release-update-quarkus-platform.yml @@ -24,44 +24,22 @@ jobs: 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' }} + quarkus-platform-branches: ${{steps.qosdk-metadata.outputs.quarkus_platform_branches}} steps: - - uses: actions/checkout@v4 + - uses: radcortez/project-metadata-action@main + name: Retrieve project metadata + id: metadata with: - ref: ${{github.event.inputs.tag || github.ref_name}} + github-token: ${{secrets.GITHUB_TOKEN}} + metadata-file-path: '.github/project.yml' + local-file: true - - name: Gather versions - id: versions + - name: Parse QOSDK metadata + id: qosdk-metadata run: | - quarkus_version=$(./mvnw help:evaluate -Dexpression=quarkus.version -q -DforceStdout) - quarkus_major=$(echo ${quarkus_version} | cut -d . -f 1,2) - echo "QOSDK-defined Quarkus version: ${quarkus_version} (-> major: ${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=${quarkus_major} - 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 + quarkus_platform_branches=$(echo '${{steps.metadata.outputs.json}}' | jq -c '.release.["quarkus-platform-branches"]') + echo "quarkus_platform_branches=${quarkus_platform_branches}" >> $GITHUB_OUTPUT - name: Wait for QOSDK BOM to be published uses: quarkusio/monitor-artifact-publication-action@main @@ -76,22 +54,12 @@ jobs: poll-iterations: 10 post-delay: 0 - update-quarkus-platform-branch: + quarkus-platform-branch-pull-requests: uses: ./.github/workflows/release-quarkus-platform-pr.yml needs: - prepare-platform-pr with: qosdk-version: ${{github.event.inputs.tag || github.ref_name}} - quarkus-platform-branch: ${{needs.prepare-platform-pr.outputs.quarkus-platform-branch}} + quarkus-platform-branches: ${{needs.prepare-platform-pr.outputs.quarkus-platform-branches}} secrets: qosdk-bot-token: ${{ secrets.QOSDK_BOT_TOKEN }} - - update-quarkus-platform-main-if-needed: - needs: - - prepare-platform-pr - if: ${{ needs.prepare-platform-pr.outputs.needs-main-pr && needs.prepare-platform-pr.outputs.quarkus-platform-branch != 'main' }} - uses: ./.github/workflows/release-quarkus-platform-pr.yml - with: - qosdk-version: ${{github.event.inputs.tag || github.ref_name}} - secrets: - qosdk-bot-token: ${{ secrets.QOSDK_BOT_TOKEN }} \ No newline at end of file