0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

microCMSのweb hookでmainとdevelopブランチどちらもデプロイしたい時

0
Last updated at Posted at 2025-11-24

前提

microCMSのweb hookからGithub Actionsを実行して、Vercelにデプロイしていた

やりたかったこと

開発中はmicroCMSでweb hookを実行したときに、main(Production)とdevelop(Preview)の両方にデプロイしたい。

こまったこと

Github Actionsでは、ref: developを指定してブランチ指定しようとしたものの、mainブランチがPreviewとしてデプロイされる。
(mainなのにPreviewなのは、vercel-args: --prodを指定してないため)

解決方法

Vercelの[Settings]→[Git]→[Deploy Hooks]で、デプロイしたいブランチ(今回はdevelop)を指定したDeploy hooksを作成して、それをGithub Actionsで呼び出せばデプロイできた。

steps:
      - name: Call the web hook(適当な名前)
        run: curl -X POST ${{ secrets.API_URL }}

※1 API_URLは、Githubにも環境変数として登録が必要
※2 Vercelの[Settings]→[Git]→[Ignored Build Step]でブランチが除外されてないか要確認

わかったこと(今の所)

  • GitHub Actionsでactions/checkoutでdevelopをデプロイしようとしてもできない

参考にさせていただいた記事

最後に

とりあえずやった結果の情報なので間違ってたらごめんなさい

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?