From 0b234bc5ea26c698c19a9df2d4f0b1496cc171e6 Mon Sep 17 00:00:00 2001 From: nitrobass24 Date: Sat, 28 Nov 2026 18:33:00 -0600 Subject: [PATCH 1/2] Release job: leave a draft GitHub release with the list of merged pull requests After the branches are written, the job creates a draft release for the tag with GitHub's generated list of the pull requests merged since the nearest earlier tag. The maintainer writes the top of the notes and publishes it. A rerun leaves an existing release alone; a dry run creates nothing. Uses the App token the job already has (contents: write). --- .github/workflows/bp-release.yml | 24 +++++++++++++++++++++++- docs/RELEASING.md | 13 +++++++++---- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/.github/workflows/bp-release.yml b/.github/workflows/bp-release.yml index fefd3115ce..f0b76005f3 100644 --- a/.github/workflows/bp-release.yml +++ b/.github/workflows/bp-release.yml @@ -87,7 +87,7 @@ jobs: private-key: ${{ secrets.SYNC_APP_PRIVATE_KEY }} owner: BluePilotDev repositories: bluepilot - permission-contents: write # the push; nothing else + permission-contents: write # the push and the draft release; nothing else # the dispatched ref (the default branch) is the code; the tag is only read as data. History and trees only, no LFS, # and the working tree is just .github. Pushes use the App token's URL. - uses: actions/checkout@v7 @@ -107,3 +107,25 @@ jobs: GH_TOKEN: ${{ github.token }} BP_TOKEN: ${{ steps.bp.outputs.token }} # empty on a dry run run: python3 .github/bp_release.py + # A draft GitHub release for the tag, with GitHub's list of the pull requests merged since the release before it. The + # maintainer writes the top of the notes and publishes it (docs/RELEASING.md); a draft notifies nobody. Runs only after + # bp_release.py accepted the tag. A rerun leaves an existing release alone. + - name: Draft the GitHub release + if: inputs.dry_run != true + env: + TAG: ${{ inputs.tag }} # checked by bp_release.py in the step above + TAG_PREFIX: ${{ inputs.tag_prefix }} + GH_TOKEN: ${{ steps.bp.outputs.token }} + run: | + if gh release view "$TAG" -R "$GITHUB_REPOSITORY" > /dev/null 2>&1; then + echo "a release for $TAG already exists: left as it is" + exit 0 + fi + # the list starts at the nearest tag before this one (the previous release, or the baseline tag for the first one); + # the job's throwaway test tags never count + since=() + if prev=$(git describe --tags --abbrev=0 --exclude 'bpx-test/*' "refs/tags/$TAG^" 2> /dev/null); then + since=(--notes-start-tag "$prev") + fi + gh release create "$TAG" -R "$GITHUB_REPOSITORY" --draft --verify-tag --title "BluePilot ${TAG#"$TAG_PREFIX"}" \ + --generate-notes "${since[@]}" diff --git a/docs/RELEASING.md b/docs/RELEASING.md index f70cf877f7..5f970907a7 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -26,9 +26,12 @@ A version number is `MAJOR.MINOR.PATCH`. `7.2.0` is a **new version**; `7.2.1` i git tag v7.2.0 && git push origin v7.2.0 ``` 4. **Watch the `bpx release` run** in the Actions tab. It creates `bp-7.2` at the tagged commit and moves - `bp-stable` to it. -5. **Update the flasher** if this version runs a different AGNOS (see below). -6. **Tell people:** the install links in `README.md`, the short links, and the announcement on Discord. + `bp-stable` to it, then leaves a **draft** GitHub release for the tag. +5. **Write the release notes and publish the draft** (Releases page). The draft already lists the pull requests + merged since the release before it. Add a section above that list, written for owners: what is new, what was + not driven, and any warning. Nobody is notified until it is published. +6. **Update the flasher** if this version runs a different AGNOS (see below). +7. **Tell people:** the install links in `README.md`, the short links, and the announcement on Discord. ## Releasing a patch (7.2.1) @@ -43,6 +46,8 @@ A fix always lands on `bp-dev` first, so the next version has it too. git tag v7.2.1 && git push origin v7.2.1 ``` `bp-stable` follows only if 7.2 is still the highest version. A patch to an older version leaves it alone. +5. Write the notes on the draft release and publish it, as for a new version. Its list covers what was merged into + `bp-7.2` since `v7.2.0`. ## What the job refuses @@ -96,7 +101,7 @@ throwaway names, all under `bpx-test/`: | `dry_run` | on prints what it would do; off does it | Push CI runs on `bpx-test/**` branches, so a test commit can get the green checks the job looks for. Delete the test -branches and tags afterward. +branches and tags afterward, and the draft release a real (not dry) test run leaves. ## Why it works this way From a5d2e34cee7a5eebcd321d5e8040b50426d50f2f Mon Sep 17 00:00:00 2001 From: nitrobass24 Date: Sat, 28 Nov 2026 19:53:51 -0600 Subject: [PATCH 2/2] Release job: a test run's draft is titled TEST, a failed listing can't leave a second draft, and the docs say what to do when the draft step fails --- .github/workflows/bp-release.yml | 27 ++++++++++++++++++--------- docs/RELEASING.md | 19 ++++++++++++++----- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/.github/workflows/bp-release.yml b/.github/workflows/bp-release.yml index f0b76005f3..81afcd6a51 100644 --- a/.github/workflows/bp-release.yml +++ b/.github/workflows/bp-release.yml @@ -1,8 +1,9 @@ # BluePilot: the release job (spec: #227). A pushed release tag (v7.2.0, v7.2.1) creates the version's branch (bp-7.2) for a -# new version and moves bp-stable when it's the highest version released. The rules are in .github/bp_release.py; any -# failed rule writes nothing. Full BluePilot only: this file doesn't exist in ford-op/bp-sunnypilot. +# new version and moves bp-stable when it's the highest version released, then leaves a draft GitHub release for the tag. +# The rules are in .github/bp_release.py; any failed rule writes nothing. Full BluePilot only: this file doesn't exist in ford-op/bp-sunnypilot. # -# The App token can push to bp-stable, so only the default branch's reviewed workflow file may hold it. A tag push runs the +# The App token can push to bp-stable (and creates the draft release), so only the default branch's reviewed workflow file +# may hold it. A tag push runs the # tagged commit's copy of this file: there, `dispatch` only checks the tag's form and starts a workflow_dispatch run on the # default branch with the built-in token (one of the two events that token can start a run with). `release` runs only on # workflow_dispatch, in the bpx-sync environment, whose single rule (the default branch) needs no tag rule. A ruleset @@ -107,9 +108,10 @@ jobs: GH_TOKEN: ${{ github.token }} BP_TOKEN: ${{ steps.bp.outputs.token }} # empty on a dry run run: python3 .github/bp_release.py - # A draft GitHub release for the tag, with GitHub's list of the pull requests merged since the release before it. The - # maintainer writes the top of the notes and publishes it (docs/RELEASING.md); a draft notifies nobody. Runs only after - # bp_release.py accepted the tag. A rerun leaves an existing release alone. + # A draft GitHub release for the tag, with GitHub's list of the pull requests merged since the nearest earlier tag in + # its history. The maintainer writes the top of the notes and publishes it (docs/RELEASING.md); a draft notifies nobody. + # Runs only after bp_release.py accepted the tag, so the branches are already written: if this step fails, run the job + # again (bp_release.py then has nothing to do and the draft is made). A rerun leaves an existing release alone. - name: Draft the GitHub release if: inputs.dry_run != true env: @@ -117,7 +119,10 @@ jobs: TAG_PREFIX: ${{ inputs.tag_prefix }} GH_TOKEN: ${{ steps.bp.outputs.token }} run: | - if gh release view "$TAG" -R "$GITHUB_REPOSITORY" > /dev/null 2>&1; then + # every release, drafts included. A listing that fails stops the step here: guessing "none yet" could leave a + # second draft for the same tag + releases=$(gh release list -R "$GITHUB_REPOSITORY" --limit 1000 --json tagName --jq '.[].tagName') + if grep -qxF -- "$TAG" <<< "$releases"; then echo "a release for $TAG already exists: left as it is" exit 0 fi @@ -127,5 +132,9 @@ jobs: if prev=$(git describe --tags --abbrev=0 --exclude 'bpx-test/*' "refs/tags/$TAG^" 2> /dev/null); then since=(--notes-start-tag "$prev") fi - gh release create "$TAG" -R "$GITHUB_REPOSITORY" --draft --verify-tag --title "BluePilot ${TAG#"$TAG_PREFIX"}" \ - --generate-notes "${since[@]}" + # a test run's draft (docs/RELEASING.md, "Testing the release job") must not read as the real one + title="BluePilot ${TAG#"$TAG_PREFIX"}" + case "$TAG" in + bpx-test/*) title="TEST $TAG: not a release, delete this draft" ;; + esac + gh release create "$TAG" -R "$GITHUB_REPOSITORY" --draft --verify-tag --title "$title" --generate-notes "${since[@]}" diff --git a/docs/RELEASING.md b/docs/RELEASING.md index 5f970907a7..82c90cbb01 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -26,10 +26,17 @@ A version number is `MAJOR.MINOR.PATCH`. `7.2.0` is a **new version**; `7.2.1` i git tag v7.2.0 && git push origin v7.2.0 ``` 4. **Watch the `bpx release` run** in the Actions tab. It creates `bp-7.2` at the tagged commit and moves - `bp-stable` to it, then leaves a **draft** GitHub release for the tag. + `bp-stable` to it, then leaves a **draft** GitHub release for the tag. If the run goes red at the draft step, + the branches have already moved: run it again. It leaves them alone and makes the draft. 5. **Write the release notes and publish the draft** (Releases page). The draft already lists the pull requests - merged since the release before it. Add a section above that list, written for owners: what is new, what was - not driven, and any warning. Nobody is notified until it is published. + merged since the nearest earlier tag in the tag's history, which for a new version is the previous version's + first release (`v7.1.0` for `v7.2.0`). Fixes that also went out in a patch (`v7.1.1`) are listed again: remove + them. Add a section above the list, written for owners: what is new, what was not driven, and any warning. + Nobody is notified until it is published. + + For `v7.1.0`, the first release made this way, the list starts at the tag `bp-7.0-base` (where `bp-dev` and + `bp-7.0` last shared a commit), so it includes the fixes `bp-dev` got that `bp-7.0` users never did. It also + lists #220, which `bp-7.0` already has: remove that line. 6. **Update the flasher** if this version runs a different AGNOS (see below). 7. **Tell people:** the install links in `README.md`, the short links, and the announcement on Discord. @@ -101,11 +108,13 @@ throwaway names, all under `bpx-test/`: | `dry_run` | on prints what it would do; off does it | Push CI runs on `bpx-test/**` branches, so a test commit can get the green checks the job looks for. Delete the test -branches and tags afterward, and the draft release a real (not dry) test run leaves. +branches and tags afterward, and the draft release a real (not dry) test run leaves. That draft is titled +"TEST ..." and carries the real list, since test tags are never a starting point. ## Why it works this way -- **Only the default branch's copy of the workflow holds the key** that can move `bp-stable`. A tag push runs the +- **Only the default branch's copy of the workflow holds the key** that can move `bp-stable` and create the draft + release. A tag push runs the tagged commit's copy, which can only ask the default branch's copy to run. - **Branch rules back the job up:** `v*` tags are admin-only, `bp-stable` accepts only the release job, and version branches can't be deleted or force-pushed.