Repository navigation
XCL-200 agent-dev-kit に Cloudflare Workers の Preview と本番のデプロイの再利用ワークフローを足す - #13
Merged
Merged
Conversation
…are-stack # Conflicts: # README.md
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.
概要
静的な SPA を Cloudflare Workers に出す仕組み (PR の Preview の公開と削除、本番のデプロイ) を、kit の技術ごとの部品
stacks/cloudflare-workers/にする。プロジェクトごとに違う点は入力にし、各リポジトリが同じワークフローを SHA で固定して呼べるようにする。変更内容
.github/workflows/stack-cloudflare-workers.yml: 再利用ワークフロー (preview・cleanup・deploy)base-branches) をビルドし、公開の直前に PR が開いているかを確かめてからwrangler previewで公開し、URL をコメントcode: 10025は成功)。マージした PR なら、同じコミットの kit を checkout してactions/delete-merged-branchで head のブランチを消すproduction-branchへの push と手動の実行でwrangler deploycloudflare_api_token・cloudflare_account_idをworkflow_call.secretsで受けるjob.workflow_repository・job.workflow_shaで取るscripts/ci/cloudflare-workers.mjsとテスト: ビルドの環境変数の検査とGITHUB_ENVへの書き込み、Preview の URL の取り出し、code: 10025の判定stacks/cloudflare-workers/README.md: 前提 (wrangler の設定、Secrets、権限)、呼び出し側の例、入力、ビルドの環境変数を JSON にした理由README.mdの表に 1 行、docs/SETUP.mdの §4 の stacks の案内の行に Cloudflare Workers を足す受け入れ条件
.github/workflows/stack-cloudflare-workers.ymlがある (preview・cleanup・deploy のジョブ)actions/delete-merged-branchを使うstacks/cloudflare-workers/README.mdに、呼び出し側の例と前提 (wrangler の設定、権限) を書き、kit の README の表に足す。SETUP の §1〜§8 には Cloudflare を前提にした手順を書かない動作確認
node --test 'scripts/ci/*.test.mjs' 'ops/linear-janitor/*.test.mjs' 'ops/manager-precheck/*.test.mjs'(142 件成功)docker run --rm -v "$PWD:/repo" -w /repo rhysd/actionlint:1.7.12 -ignore 'workflow_(repository|sha)'(指摘 0 件)10025は成功、マージした PR のブランチの削除、本番のブランチへの push と手動の実行) になることを読んで比べたリスクの確認
.env*、キー、トークン) を含めていない人が確認すること
補足
envが再利用ワークフローに引き継がれず、with:には文字列・数・真偽しか渡せないため。with:ではsecretsを使えないので、Secrets は入らない (公開してよい値だけ)。actions/delete-merged-branchはuses:に式を書けないので、job.workflow_shaの kit を.agent-dev-kitに sparse checkout して./で呼ぶ。ワークフローと同じコミットのアクションになる。gh pr comment --edit-lastで、token の持ち主の最後のコメントを書き換える。同じ token で別のコメントを書くジョブがあると、そちらを書き換える。