From 1bb5100da85ed5d895c0671c476aa7f4f00ff7eb Mon Sep 17 00:00:00 2001 From: RealiCZ Date: Fri, 20 Nov 2026 18:53:30 +0800 Subject: [PATCH] ci: attach mega-evme to the release at publication release-settle.yml now builds mega-evme in a credential-free job and passes it to release-publish as asset_files. Releases are immutable once published, so the binary must be attached before publication. --- .claude/skills/bump-version-release/SKILL.md | 2 +- .github/workflows/on-release.yml | 7 ++- .github/workflows/release-settle.yml | 51 +++++++++++++++++++- 3 files changed, 54 insertions(+), 6 deletions(-) diff --git a/.claude/skills/bump-version-release/SKILL.md b/.claude/skills/bump-version-release/SKILL.md index d24b3612e..d4f097fb3 100644 --- a/.claude/skills/bump-version-release/SKILL.md +++ b/.claude/skills/bump-version-release/SKILL.md @@ -18,7 +18,7 @@ Releases are made by the org release pipeline (megaeth-labs/.github). Two decisi 3. **Publish** — merging the settle PR pushes to `release-vX.Y.Z`, which routes to `publish`. That job runs in the `release` environment and waits for its reviewer, then creates the annotated tag `vX.Y.Z` on the merge commit and publishes the GitHub Release with the settle PR's notes. The dispatch is not the approval; the merge plus the environment reviewer is. 4. **Targets** — automatic on the Release: `on-release.yml` uploads `mega-evme` to the MegaETH artifact registry, in the `release` environment. crates.io publishing is paused while the OP crates are git-pinned (see the root `Cargo.toml`), so no crates are published. - Release assets are paused: Releases are immutable once published, so `on-release.yml` attaches nothing to them. + Publishing attaches `mega-evme` and `SHA256SUMS` to the Release through `release-settle.yml` and `release-publish`'s `asset_files`. Rehearse `on-release.yml` first on an existing tag, dispatching on that tag's ref: `gh workflow run on-release.yml --ref vX.Y.Z -f dry_run=true`. The tag being released is always the run's own ref; there is no separate tag input. The publish credential, `GCP_AUTH_KEY`, lives in the `release` environment, whose deployment policy admits `main`, `release-v*` branches and `v*` tags. diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index 456b63708..a120eb474 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -13,10 +13,9 @@ name: On Release # no crates are published. To resume once those crates are on crates.io, # restore the `crates` job from PR #424. # -# Release assets are paused as well. Releases here are immutable once -# published, and this workflow runs only after publishing, so attaching the -# binary to the Release fails (HTTP 422). The binary goes to the registry -# only until the release pipeline attaches assets before it publishes. +# `release-settle.yml` builds mega-evme and `release-publish` attaches it with +# SHA256SUMS (`asset_files`) before the Release is published, because Releases +# are immutable once published; this workflow keeps the registry upload. # # Rehearse on a tag ref (the job must run on a tag ref): # gh workflow run on-release.yml --ref vX.Y.Z -f dry_run=true diff --git a/.github/workflows/release-settle.yml b/.github/workflows/release-settle.yml index 9311804d7..49fb4e953 100644 --- a/.github/workflows/release-settle.yml +++ b/.github/workflows/release-settle.yml @@ -114,9 +114,51 @@ jobs: version_pattern: toml changelog_file: CHANGELOG.md - publish: + # Releases are immutable once published, so the binary is built first, in a + # job with no credentials, and attached to the draft at publication. + build: needs: route if: needs.route.outputs.action == 'publish' + runs-on: ubuntu-24.04 + timeout-minutes: 40 + permissions: + contents: read + steps: + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 + with: + ref: ${{ needs.route.outputs.commit }} + submodules: recursive + persist-credentials: false + + - uses: actions-rust-lang/setup-rust-toolchain@166cdcfd11aee3cb47222f9ddb555ce30ddb9659 # v1 + with: + cache: false + + - uses: foundry-rs/foundry-toolchain@b00af27efadbc7b4ca8b82abbd903b17cc874d2a # v1 + + - name: Build mega-evme + run: cargo build --release --locked -p mega-evme + + - id: version + name: Derive the release version + env: + RELEASE_BRANCH: ${{ needs.route.outputs.release_branch }} + run: echo "version=${RELEASE_BRANCH#release-v}" >> "$GITHUB_OUTPUT" + + - uses: megaeth-labs/.github/.github/actions/release-verify-version@main + with: + command: target/release/mega-evme --version + version: ${{ steps.version.outputs.version }} + + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: release-files + path: target/release/mega-evme + if-no-files-found: error + + publish: + needs: [route, build] + if: needs.route.outputs.action == 'publish' # One publish per release branch: the tag guard and the tag push are two # steps, so a re-run must queue behind a run in flight, never overlap it. concurrency: @@ -141,6 +183,11 @@ jobs: fetch-depth: 0 persist-credentials: false + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 + with: + name: release-files + path: release-files + - uses: megaeth-labs/.github/.github/actions/release-publish@main with: token: ${{ steps.release-token.outputs.token }} @@ -151,3 +198,5 @@ jobs: version_file: Cargo.toml version_pattern: toml changelog_file: CHANGELOG.md + asset_files: | + release-files/mega-evme