Repository navigation
ci: build release artifacts in a tag-scoped workflow - #11
Merged
Merged
Conversation
Release Please now only creates the draft release and dispatches the new Release Artifacts workflow on the tag, so a later push replacing a pending run can no longer strand the draft behind a ref/SHA mismatch. Automatic and manual runs share that single tag-scoped path. The artifact workflow refuses to run unless the release is still a draft, because --clobber deletes assets before re-uploading and would break a published release on failure. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Per-tag concurrency lets an older tag's artifact run finish after a newer release is published. Publishing with gh release edit implies make_latest=true, so the older release would take latest and the README installer would serve it. Publish through the REST API with make_latest=legacy so GitHub picks latest by date and semantic version. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gh api -f sends draft=false as the JSON string "false", but the Release API requires a boolean. Use the typed -F flag for draft and keep make_latest as a string field. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
release_artifacts.ymlに分け,release-please がタグ上で起動する.自動でも手動でも同じ経路を通るため,draft が取り残されなくなる.成果物ワークフローは draft の Release にしか触れない.draftを boolean のfalse,make_latestをlegacyとして送り,古いタグの実行が後から終わっても新しい版の latest を奪わない.release_please.yml内の後続ジョブrelease_artifacts.ymlをタグ上でworkflow_dispatch起動release_please.ymlのworkflow_dispatchgh workflow run release_artifacts.yml --ref <tag> -f tag_name=<tag>GITHUB_SHAは常にタグのコミット--clobberで上書きできてしまうisDraftを確認し,draft でなければ失敗gh release edit --draft=false(make_latest は true 扱い)gh api -X PATCH .../releases/<id> -F draft=false -f make_latest=legacy(draftは boolean)受け入れ条件
release_please.ymlがrelease_artifacts.ymlをタグ上で起動し,成果物のアップロード後に Release が公開されるreleases/latest/downloadのインストーラーが最新版を配るrelease_artifacts.ymlはタグ以外の ref,HEAD とGITHUB_SHAの不一致,公開済みの Release でビルド前に失敗するdraftを boolean(-F draft=false),make_latestをlegacyとして送り,gh release editを使わない詳細
経緯
#8 のレビュー(Codex)で見つかった 2 件と,この PR のレビューで見つかった 2 件の修正.#8 は修正前の
eee0747の時点で squash マージされたため,修正コミットを main の上に cherry-pick して出し直した.1. [high] 公開済み Release の作り直し
gh release upload --clobberは各アセットを消してから上げ直す.公開済みの Release を手動で作り直すと,途中のネットワーク障害でファイルが欠けたまま公開状態になり,README のreleases/latestのインストーラー URL が壊れるVerify release targetステップでgh release view "$TAG_NAME" --json isDraft --jq .isDraftがtrueでなければ失敗する2. [medium] draft の取り残し
GITHUB_SHA=S となってガードで失敗する.release-please は PR を tagged 済みにしているため以後release_createdは立たず,draft が残るrelease_please.ymlは draft とタグを作るだけにし,release_createdのときにgh workflow run release_artifacts.yml --ref "$TAG_NAME" -f tag_name="$TAG_NAME"を実行する.ジョブには既存の権限に加えてactions: writeを付け,GITHUB_TOKENで起動する(workflow_dispatchはGITHUB_TOKENからでも新しい実行を作れる)release_artifacts.ymlはworkflow_dispatchのみで,concurrency はタグごと.ref と SHA のガードは維持する3. [medium] 古い版が latest を奪う問題(
ef18660)make_latestを指定せずに公開すると true 扱いになり,古い版が latest になって README のインストーラーが古い版を配るPublish releaseステップでgh release view "$TAG_NAME" --json databaseIdから ID を取り,REST API の PATCH でmake_latest=legacyを指定して公開する.legacyでは GitHub が作成日時と semver から latest を選ぶ4. [high]
draftが文字列で送られる問題(814caa9)gh api -f draft=falseは JSON の文字列"false"を送るが,Release API は boolean を要求するdraftは typed の-F draft=falseで送る(gh apiの-Fはtrue,false,null,整数を JSON の型に変換する).make_latestは文字列なので-f make_latest=legacyのまま変更ファイル
.github/workflows/release_please.yml:成果物ジョブを外し,起動ステップを追加.github/workflows/release_artifacts.yml:新規(ガード,-F draft=false -f make_latest=legacyの公開ステップを含む)CONTRIBUTING.md:Release 節ローカル検証
Verify release targetの本体をコミット済みのワークフローから取り出し,/bin/bash3.2 と偽のghで 6 ケース検証(ref が main,別タグ,SHA 不一致,公開済み,draft 状態が空は失敗,タグ上で SHA 一致かつ draft は成功)Publish releaseの本体を同様に取り出し,呼び出しを記録する偽のghで 4 ケース検証(終了コード 0,api -X PATCH repos/furedea/apple-mail-cli/releases/4242 -F draft=false -f make_latest=legacyが 1 回,release editは 0 回,-f draft=は 0 回).-f draft=falseの時点では 2 件失敗,修正後は 4 件成功actionlint,zizmor --offline:指摘なしCI や実リリースでしか確認できないこと
GITHUB_TOKENによるgh workflow run --ref <tag>の起動gh release view/uploadとgh api PATCHによる公開,make_latest=legacyでの latest の選ばれ方その他
RELEASE_PLEASE_TOKENは登録済み(chore(main): release apple-mail-cli 0.1.1 #10 が作られている).この PR で必要な権限の追加はないci/release-packaged-cliは不要で,削除してよいRefs #7, #8, #10
🤖 Generated with Claude Code