From dcf6b233bf4206132e20e24a99485ec5d002b686 Mon Sep 17 00:00:00 2001 From: Adrien Cacciaguerra Date: Fri, 13 Nov 2026 12:41:52 -0800 Subject: [PATCH 1/3] ci: turn off dist's build cache instead of removing it by hand `pr-run-mode = "upload"` turns on dist's `cache-builds`, which adds a `swatinem/rust-cache` step to every build job of the generated release.yml. That step was removed by hand after each `dist generate`; `cache-builds = false` keeps it out of the generated file. Refs COD-4268 Co-Authored-By: Claude Opus 5.5 --- dist-workspace.toml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dist-workspace.toml b/dist-workspace.toml index 140c5e0de..5e9677db6 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -23,14 +23,15 @@ install-path = "CARGO_HOME" install-updater = false # Build only the required packages, and individually precise-builds = true +# `pr-run-mode = "upload"` would otherwise turn on a rust-cache step in every build job +cache-builds = false # Don't create GitHub releases, we handle that manually to manually control which release is marked as latest create-release = false # Use the stage just after plan because we need its output to create the draft release local-artifacts-jobs = ["./create-draft-release"] -# Comment this out to rerun `dist generate`, then redo these hand edits to release.yml: -# - the `gh release edit` call in `host` is replaced so the release is not marked as latest -# (https://github.com/axodotdev/cargo-dist/issues/2244) -# - the `swatinem/rust-cache` step in `build-local-artifacts` is removed +# Comment this out to rerun `dist generate`, then redo this hand edit to release.yml: +# the `gh release edit` call in `host` is replaced so the release is not marked as latest +# (https://github.com/axodotdev/cargo-dist/issues/2244) allow-dirty = ["ci"] # Dependabot bumps the pins in release.yml: copy them here before regenerating From 4d00f73f5099e201263ccc39e3155f407aa1915a Mon Sep 17 00:00:00 2001 From: Adrien Cacciaguerra Date: Fri, 13 Nov 2026 12:42:55 -0800 Subject: [PATCH 2/3] ci: let dist create the GitHub release A custom job created the release as a draft and a hand edit to release.yml undrafted it, so that only runner releases became "latest" while memtrack and exec-harness were released on their own tags. Both now ship inside the runner and dist no longer releases them, so dist's own `gh release create`, which makes a stable release latest and never a prerelease, does what we need with the same title and notes. Drop the draft job, the hand edit, and post-announce's latest step and non-runner branch. The installer and checksums job no longer waits on the draft job, which was skipped on PRs, so PRs now build it too. The hand edit also dropped dist's `--prerelease` flag, so alphas were published as regular releases; they are now GitHub pre-releases. Refs COD-4268 Co-Authored-By: Claude Opus 5.5 --- .github/workflows/create-draft-release.yml | 40 ---------------------- .github/workflows/post-announce.yml | 14 +------- .github/workflows/release.yml | 37 +++++--------------- CONTRIBUTING.md | 9 ++--- dist-workspace.toml | 8 +---- 5 files changed, 13 insertions(+), 95 deletions(-) delete mode 100644 .github/workflows/create-draft-release.yml diff --git a/.github/workflows/create-draft-release.yml b/.github/workflows/create-draft-release.yml deleted file mode 100644 index c8cf4d511..000000000 --- a/.github/workflows/create-draft-release.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Create draft release - -on: - workflow_call: - inputs: - plan: - required: true - type: string - -jobs: - main: - if: github.event_name != 'pull_request' - runs-on: ubuntu-latest - env: - PLAN: ${{ inputs.plan }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - name: Plan details - run: | - echo "Plan details: $PLAN" - - - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - name: Create draft release - run: | - RELEASE_TAG=$(echo ${PLAN} | jq -r '.announcement_tag') - ANNOUNCEMENT_TITLE=$(echo ${PLAN} | jq -r '.announcement_title') - ANNOUNCEMENT_BODY=$(echo ${PLAN} | jq -r '.announcement_github_body') - - # Write body to file to avoid quoting issues - echo "$ANNOUNCEMENT_BODY" > /tmp/release-notes.txt - - echo "Creating draft release ${RELEASE_TAG}" - # The release will be undrafted by cargo-dist after it has uploaded the artifacts - gh release create "${RELEASE_TAG}" \ - --draft \ - --title "${ANNOUNCEMENT_TITLE}" \ - --notes-file /tmp/release-notes.txt - - echo "Release created successfully" diff --git a/.github/workflows/post-announce.yml b/.github/workflows/post-announce.yml index ace40e966..7c303c961 100644 --- a/.github/workflows/post-announce.yml +++ b/.github/workflows/post-announce.yml @@ -31,10 +31,7 @@ jobs: if [ "${IS_PRE_RELEASE}" == "true" ]; then echo "runner_released=false" >> "$GITHUB_OUTPUT" - echo "Pre-release detected, cargo-dist has already undrafted this release, nothing more to do" - elif [ -z "${NEW_VERSION}" ] || [ "${NEW_VERSION}" == "null" ]; then - echo "runner_released=false" >> "$GITHUB_OUTPUT" - echo "A package other than the runner has been released, cargo-dist has already undrafted this release, nothing more to do" + echo "Pre-release detected, nothing more to do" else echo "runner_released=true" >> "$GITHUB_OUTPUT" echo "Runner version ${NEW_VERSION} was released" @@ -83,15 +80,6 @@ jobs: curl -fsS --retry 3 -o /dev/null \ https://app.codspeed.io/api/ebpf-allowlist - - name: Mark release as latest - if: steps.check_runner.outputs.runner_released == 'true' - run: | - RELEASE_TAG="${{ steps.check_runner.outputs.release_tag }}" - REPO_OWNER=$(echo ${PLAN} | jq -r '.releases[0].hosting.github.owner') - REPO_NAME=$(echo ${PLAN} | jq -r '.releases[0].hosting.github.repo') - echo "Marking release ${RELEASE_TAG} as latest" - gh release edit "${RELEASE_TAG}" -R "${REPO_OWNER}/${REPO_NAME}" --latest - - name: Trigger action runner version bump workflow if: steps.check_runner.outputs.runner_released == 'true' env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b10d794c5..661dbe9c4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,8 +10,8 @@ # * uploads those artifacts to temporary workflow zip # * on success, uploads the artifacts to a GitHub Release # -# Note that a GitHub Release with this tag is assumed to exist as a draft -# with the appropriate title/body, and will be undrafted for you. +# Note that the GitHub Release will be created with a generated +# title/body based on your changelogs. name: Release permissions: @@ -165,21 +165,11 @@ jobs: ${{ steps.cargo-dist.outputs.paths }} ${{ env.BUILD_MANIFEST_NAME }} - custom-create-draft-release: - needs: - - plan - if: ${{ needs.plan.outputs.publishing == 'true' || fromJson(needs.plan.outputs.val).ci.github.pr_run_mode == 'upload' }} - uses: $/.github/workflows/create-draft-release.yml - with: - plan: ${{ needs.plan.outputs.val }} - secrets: inherit - # Build and package all the platform-agnostic(ish) things build-global-artifacts: needs: - plan - build-local-artifacts - - custom-create-draft-release runs-on: "ubuntu-22.04" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -226,10 +216,9 @@ jobs: needs: - plan - build-local-artifacts - - custom-create-draft-release - build-global-artifacts # Only run if we're "publishing", and only if plan, local and global didn't fail (skipped is fine) - if: ${{ always() && needs.plan.result == 'success' && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') && (needs.custom-create-draft-release.result == 'skipped' || needs.custom-create-draft-release.result == 'success') }} + if: ${{ always() && needs.plan.result == 'success' && needs.plan.outputs.publishing == 'true' && (needs.build-global-artifacts.result == 'skipped' || needs.build-global-artifacts.result == 'success') && (needs.build-local-artifacts.result == 'skipped' || needs.build-local-artifacts.result == 'success') }} env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} runs-on: "ubuntu-22.04" @@ -280,24 +269,14 @@ jobs: - name: Create GitHub Release env: PRERELEASE_FLAG: "${{ fromJson(steps.host.outputs.manifest).announcement_is_prerelease && '--prerelease' || '' }}" + ANNOUNCEMENT_TITLE: "${{ fromJson(steps.host.outputs.manifest).announcement_title }}" + ANNOUNCEMENT_BODY: "${{ fromJson(steps.host.outputs.manifest).announcement_github_body }}" RELEASE_COMMIT: "${{ github.sha }}" run: | - # If we're editing a release in place, we need to upload things ahead of time - gh release upload "${{ needs.plan.outputs.tag }}" artifacts/* + # Write and read notes from a file to avoid quoting breaking things + echo "$ANNOUNCEMENT_BODY" > $RUNNER_TEMP/notes.txt - # ⚠️ MANUAL EDIT - # Replacement for the generated line - # gh release edit "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --draft=false - # - # Customize gh release edit call to prevent gh release edit --draft=false from marking the release as latest - # https://github.com/axodotdev/cargo-dist/issues/2244 - export RELEASE_ID=$(gh api repos/{owner}/{repo}/releases --jq '.[] | select(.tag_name == "${{ needs.plan.outputs.tag }}") | .id') - if [ -z "$RELEASE_ID" ]; then - echo "Error: Could not find release ID for tag" - exit 1 - fi - gh api repos/{owner}/{repo}/releases/$RELEASE_ID --method PATCH -f draft=false - # ⚠️ END OF MANUAL EDIT + gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/* announce: needs: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c06d39e02..717cf8f75 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -89,12 +89,9 @@ When you run `cargo release --execute `, the following happens: 1. **cargo-release** bumps the version, creates a commit and a git tag, then pushes them to GitHub 2. **GitHub Actions release workflow** triggers on the tag: - - Custom `cargo-dist` job creates a draft GitHub release - - `cargo-dist` builds artifacts for all platforms, uploads them to the draft release, and then publishes it -3. Only if it is a runner release: - - Custom post announce job marks it as "latest" and triggers action repo workflow - -This ensures only stable runner releases are marked as "latest" in GitHub. + - `cargo-dist` builds artifacts for all platforms and creates the GitHub release with them +3. Only if it is a stable release: + - Custom post announce job triggers action repo workflow ## Known issue diff --git a/dist-workspace.toml b/dist-workspace.toml index 5e9677db6..3a7277083 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -25,13 +25,7 @@ install-updater = false precise-builds = true # `pr-run-mode = "upload"` would otherwise turn on a rust-cache step in every build job cache-builds = false -# Don't create GitHub releases, we handle that manually to manually control which release is marked as latest -create-release = false -# Use the stage just after plan because we need its output to create the draft release -local-artifacts-jobs = ["./create-draft-release"] -# Comment this out to rerun `dist generate`, then redo this hand edit to release.yml: -# the `gh release edit` call in `host` is replaced so the release is not marked as latest -# (https://github.com/axodotdev/cargo-dist/issues/2244) +# Dependabot bumps the action pins in release.yml allow-dirty = ["ci"] # Dependabot bumps the pins in release.yml: copy them here before regenerating From eb9d9f984a1cd79f97cecde640c99c11be9c7d00 Mon Sep 17 00:00:00 2001 From: Adrien Cacciaguerra Date: Fri, 13 Nov 2026 12:43:45 -0800 Subject: [PATCH 3/3] ci: fail PRs whose release.yml differs from what dist generates release.yml no longer carries hand edits, so drop `allow-dirty`: dist's plan, which runs on every PR, now fails when the file differs from what `dist generate` produces from dist-workspace.toml. Dependabot bumped the action pins in release.yml, which would now fail that check. Exclude the file from dependabot; its pins are bumped in `[dist.github-action-commits]` before regenerating. Refs COD-4268 Co-Authored-By: Claude Opus 5.5 --- .github/dependabot.yml | 3 +++ dist-workspace.toml | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 253bcb76b..c21b35cf2 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -2,5 +2,8 @@ version: 2 updates: - package-ecosystem: github-actions directory: / + # Generated by `dist generate` from dist-workspace.toml + exclude-paths: + - .github/workflows/release.yml schedule: interval: daily diff --git a/dist-workspace.toml b/dist-workspace.toml index 3a7277083..3d544b63d 100644 --- a/dist-workspace.toml +++ b/dist-workspace.toml @@ -25,10 +25,8 @@ install-updater = false precise-builds = true # `pr-run-mode = "upload"` would otherwise turn on a rust-cache step in every build job cache-builds = false -# Dependabot bumps the action pins in release.yml -allow-dirty = ["ci"] -# Dependabot bumps the pins in release.yml: copy them here before regenerating +# Pins for the generated release.yml, which dependabot skips: bump them here, then run `dist generate` [dist.github-action-commits] "actions/checkout" = "3d3c42e5aac5ba805825da76410c181273ba90b1" # v7.0.1 "actions/upload-artifact" = "043fb46d1a93c77aae656e7c1c64a875d1fc6a0a" # v7.0.1