Github Actionsでchrome拡張のリリース周りのあれこれを自動化する
参考
PRのラベルでpackage.jsonを更新する
https://zenn.dev/team_zenn/articles/version-up-labeling
github acitonsでtypescriptのスクリプトを呼び出す
https://zenn.dev/ring_belle/articles/github-actions-ts
action内で三項演算子ライクな分岐をする
https://dev.classmethod.jp/articles/github-actions-get-only-necessary-secrets-according-to-branch-name-in-ternary-operator-like-description/
action.ymlの構文
https://docs.github.com/ja/actions/creating-actions/metadata-syntax-for-github-actions
やりたいこと
バージョンのbump upの自動化
package.jsonとmanifest.jsonそれぞれのversion
PRのラベルでセマンティックバージョニングのどの層なのか判定
mainブランチに修正を自動コミット
chrome web storeへの申請作業の自動化
release note作成の自動化
処理内容
package.jsonから現在のバージョン取得
ラベルを見てバージョンの更新の判定
更新後のバージョンで上書き
tips
botの操作がpermissionエラーになる
remote: Permission to mmrakt/chrome-extension-auto-release-sandbox.git denied to github-actions[bot].
⇨settings > actions > general > workflow permissionでread & writeに変更する
デバッグ機能を有効化にするにはsettings>secrets>actionsで以下を登録する
key: ACTIONS_STEP_DEBUG value: true
workflowの動作確認で何度もブランチ&PR作成する作業はdevtoolのrecorder機能使えばある程度自動化できる
→pupeteerに出力してコード管理してもよさそう
localリポジトリでコードのコミット&タグづけするワンライナー
code:sh
git add . && git commit -m "commit" && git tag -d v0.1.0 && git tag -a -m "commit" v0.1.0 && git push origin main --follow-tags
ifブロックでbooleanの結果が一致しない
actionではtrueと'true'を別物として扱うので、trueでうまくいかなければ'true'で試してみる
PRのlabelの数を確認したい
jqコマンドで取る方法がある:https://github.com/orgs/community/discussions/27125