From e5ab2cf246408ff6a0cb05f7fa0bf6bbdbcd5a40 Mon Sep 17 00:00:00 2001 From: Jan von Loewenstein Date: Thu, 9 Jul 2026 15:14:12 +0200 Subject: [PATCH 1/4] Release automatilly if cats is successful Co-authored-by: Ralf Pannemans --- .github/workflows/kind-cats.yaml | 1 - .github/workflows/release.yaml | 87 ++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/kind-cats.yaml b/.github/workflows/kind-cats.yaml index f91244f3..437fb399 100644 --- a/.github/workflows/kind-cats.yaml +++ b/.github/workflows/kind-cats.yaml @@ -77,4 +77,3 @@ jobs: with: name: report path: ./cf-acceptance-tests/report.json - diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..776f4981 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,87 @@ +name: Release + +on: + workflow_run: + workflows: ["CF Acceptance Tests on KinD"] + types: [completed] + branches: [main] + +jobs: + release: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v6 + + - name: Get commit info and calculate next version + id: commit-info + run: | + COMMIT_SHA=${{ github.event.workflow_run.head_sha }} + echo "commit_sha=$COMMIT_SHA" >> $GITHUB_OUTPUT + + # Get latest tag + LATEST_TAG=$(gh release view --json tagName --jq '.tagName' 2>/dev/null || echo "") + + if [ -z "$LATEST_TAG" ]; then + # No existing tags, start with v0.0.1 + NEW_VERSION="v0.0.1" + else + # Remove 'v' prefix if present + VERSION=${LATEST_TAG#v} + + # Parse major.minor.patch + IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" + + # Increment patch + PATCH=$((PATCH + 1)) + NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}" + fi + + echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT + echo "Latest tag: ${LATEST_TAG:-none}, New version: $NEW_VERSION" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Check if version already released + id: check-existing-release + run: | + COMMIT_SHA=${{ steps.commit-info.outputs.commit_sha }} + + # Compare this run's commit to the latest release target commit. + LATEST_RELEASE_COMMIT=$(gh release view --json targetCommitish --jq '.targetCommitish' 2>/dev/null || echo "") + + if [ -z "$LATEST_RELEASE_COMMIT" ]; then + echo "should_create_release=true" >> $GITHUB_OUTPUT + echo "No previous release found; release will be created" + elif [ "$LATEST_RELEASE_COMMIT" = "$COMMIT_SHA" ]; then + echo "should_create_release=false" >> $GITHUB_OUTPUT + echo "Latest release already points to commit $COMMIT_SHA" + else + echo "should_create_release=true" >> $GITHUB_OUTPUT + echo "Latest release commit differs ($LATEST_RELEASE_COMMIT); release will be created" + fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create GitHub Release + if: steps.check-existing-release.outputs.should_create_release == 'true' + run: | + NEW_VERSION=${{ steps.commit-info.outputs.new_version }} + COMMIT_SHA=${{ steps.commit-info.outputs.commit_sha }} + + gh release create "$NEW_VERSION" \ + --target "$COMMIT_SHA" \ + --title "Release $NEW_VERSION" \ + --notes "Automated release for commit ${COMMIT_SHA:0:7}" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Release Summary + if: steps.check-existing-release.outputs.should_create_release == 'true' + run: | + echo "### Release Workflow Summary" >> $GITHUB_STEP_SUMMARY + echo "- Commit SHA: ${{ steps.commit-info.outputs.commit_sha }}" >> $GITHUB_STEP_SUMMARY + echo "- New Version: ${{ steps.commit-info.outputs.new_version }}" >> $GITHUB_STEP_SUMMARY + echo "- Release Created: ${{ steps.check-existing-release.outputs.should_create_release == 'true' && 'Yes' || 'No (latest release already targets this commit)' }}" >> $GITHUB_STEP_SUMMARY From 49b0f3fccad4153628c9a6a76163edd7eb5de8a2 Mon Sep 17 00:00:00 2001 From: Jan von Loewenstein Date: Thu, 9 Jul 2026 15:25:48 +0200 Subject: [PATCH 2/4] Relax schedule to prevent daily releases Co-authored-by: Ralf Pannemans --- .github/workflows/kind-cats.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/kind-cats.yaml b/.github/workflows/kind-cats.yaml index 437fb399..fae3152d 100644 --- a/.github/workflows/kind-cats.yaml +++ b/.github/workflows/kind-cats.yaml @@ -2,7 +2,7 @@ name: CF Acceptance Tests on KinD on: schedule: - - cron: '0 6 * * *' + - cron: '0 6 * * 1' workflow_dispatch: jobs: From 8e6fae1ea060c265c50234f4e9882ff83edfc7b3 Mon Sep 17 00:00:00 2001 From: Jan von Loewenstein Date: Thu, 9 Jul 2026 16:20:27 +0200 Subject: [PATCH 3/4] Remove unused step Co-authored-by: Ralf Pannemans --- .github/workflows/release.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 776f4981..3aeeb87a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -13,8 +13,6 @@ jobs: permissions: contents: write steps: - - uses: actions/checkout@v6 - - name: Get commit info and calculate next version id: commit-info run: | From e1c1ace0da0eb2ebc481773a42f8e3abd01e82dc Mon Sep 17 00:00:00 2001 From: Johannes Dillmann Date: Fri, 10 Jul 2026 10:01:11 +0200 Subject: [PATCH 4/4] Remove case for non-existing release Co-authored-by: Ralf Pannemans --- .github/workflows/release.yaml | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3aeeb87a..867b29c8 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -22,20 +22,15 @@ jobs: # Get latest tag LATEST_TAG=$(gh release view --json tagName --jq '.tagName' 2>/dev/null || echo "") - if [ -z "$LATEST_TAG" ]; then - # No existing tags, start with v0.0.1 - NEW_VERSION="v0.0.1" - else - # Remove 'v' prefix if present - VERSION=${LATEST_TAG#v} - - # Parse major.minor.patch - IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" - - # Increment patch - PATCH=$((PATCH + 1)) - NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}" - fi + # Remove 'v' prefix if present + VERSION=${LATEST_TAG#v} + + # Parse major.minor.patch + IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" + + # Increment patch + PATCH=$((PATCH + 1)) + NEW_VERSION="v${MAJOR}.${MINOR}.${PATCH}" echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT echo "Latest tag: ${LATEST_TAG:-none}, New version: $NEW_VERSION"