1
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 5 years have passed since last update.

Firebase Hosting のデプロイメッセージにgitコミットIDをつける

Posted at

Firebase Hosting でdeployする際にメッセージをつけることができます。

firebase deploy --only hosting --message "DEPLOY MESSAGE"

こうするとFirebase Hostingのリリース履歴に時刻だけではなくメッセージも表示されます。

とはいえ、いちいちメッセージを書くのも面倒です。

なので、package.jsonのdeployメッセージを次のようにします。

{
 "script":{
   "deploy": "m=`git log -1 --pretty=format:\"%h\"`;firebase deploy --only hosting --message \"git:${m}\"",
  }
}

これでyarn run deployすれば、その時のgitコミットIDがデプロイメッセージとして付与されます。

git log -1 --pretty=format:"%h"

これで最新の1行のコミットIDが出力されます。

当初コミットメッセージをデプロイメッセージにしようとgit log -1 --onelineとしたら、firebaseコマンドの--messageオプションの使用可能文字の関係なのかエラーがでることがあったので、コミットIDだけにしました。

1
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
1
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?