From f4f2b0558c7f856f1ace8d8682cac9f39eda4638 Mon Sep 17 00:00:00 2001 From: Muzahidul Islam Date: Wed, 7 Oct 2026 18:46:33 +0600 Subject: [PATCH] ci: validate release PRs and allow manual release retries Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7849d7e..6acebca1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,16 +2,23 @@ name: Release # Merging a change to OPTIMIZELYSDKVERSION into master (or release/**) tags v # and publishes a GitHub release with that version's CHANGELOG.md section as notes. +# On a release PR it only validates, so a missing CHANGELOG section fails before merge. +# Run manually (workflow_dispatch) to retry a failed release from the branch's latest commit. on: + workflow_dispatch: push: branches: [ master, 'release/**' ] paths: [ Sources/Utils/SDKVersion.swift ] + pull_request: + branches: [ master, 'release/**' ] + paths: [ Sources/Utils/SDKVersion.swift ] permissions: contents: write jobs: publish: + if: github.event_name == 'pull_request' || github.ref_name == 'master' || startsWith(github.ref_name, 'release/') runs-on: ubuntu-latest env: GH_TOKEN: ${{ github.token }} @@ -29,6 +36,9 @@ jobs: fi awk -v h="## $VERSION" '$0==h{f=1;next} /^## [0-9]/{if(f)exit} f' CHANGELOG.md > notes.md [ -s notes.md ] || { echo "CHANGELOG.md has no '## $VERSION' section"; exit 1; } + if [[ "$GITHUB_EVENT_NAME" == pull_request ]]; then + echo "v$VERSION is ready to release"; exit 0 + fi FLAGS=() [[ "$VERSION" == *-* ]] && FLAGS+=(--prerelease) [[ "$GITHUB_REF_NAME" != master ]] && FLAGS+=(--latest=false)