Skip to content

Commit

Permalink
chore: move Quarkus platform PR info to the project.yml file
Browse files Browse the repository at this point in the history
Signed-off-by: xstefank <[email protected]>
  • Loading branch information
xstefank committed Jan 21, 2025
1 parent 119ed6e commit 74d88c6
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 53 deletions.
4 changes: 3 additions & 1 deletion .github/project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
16 changes: 9 additions & 7 deletions .github/workflows/release-quarkus-platform-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,32 @@ 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

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:
distribution: 'temurin'
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
Expand All @@ -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 <[email protected]>
author: metacosm <[email protected]>
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
Expand Down
59 changes: 14 additions & 45 deletions .github/workflows/release-update-quarkus-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,44 +24,23 @@ 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
# TODO change this to radcortez/project-metadata-action@main if https://github.com/radcortez/project-metadata-action/pull/18 is merged
- uses: xstefank/project-metadata-action@json-output
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
Expand All @@ -76,22 +55,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 }}

0 comments on commit 74d88c6

Please sign in to comment.