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?

AWSを頑張らずにAmplifyのビルド結果をSlackに通知する

Last updated at Posted at 2025-04-28

はじめに

全然厳密じゃないと思う

何がしたい

Apmlifyでホスティングしているアプリケーションのビルド結果をSlackに通知したい。

何がつらい

Amplifyの機能でメールに通知はできそう。
だけどSlackへの通知はAWSをいろいろ頑張れって情報が出てくる。
AWSはよくわからないし頑張りたくもない。

どうするか

Amplifyのビルドコマンドの前後に通知コマンドを仕込んでしまう。

具体的な方法

※nextでやってます。他のフレームワークetcの場合はわかりません。

AmplifyのApp作成時にビルドコマンドを設定しているはず。
コンソールからでもamplify.ymlをダウンロードして修正するでもよし。

preBuild:
  commands:
    - ${開始を通知するコマンド}
    - npm ci --cache .npm --prefer-offline || ${失敗を通知するコマンド}
build:
  commands:
    - npm run build || ${失敗を通知するコマンド}
postBuild:
  commands:
    - ${成功を通知するコマンド} 

コマンドの中身は自分で考えてください。
環境変数を拾えるので環境ごとに通知先を分けたりも可能なはず。

おわりに

こういう甘えは怒られそう。

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?