Skip to content

nana4rider/deploy-webhook

Repository files navigation

Deploy Webhook

License: ISC GitHub Actions Test GitHub Actions Release

概要

GitHub Actionsからデプロイスクリプトを実行するためのAPIです。

使い方

Native

npm install
npm run build
node --env-file=.env dist/index

Docker

docker run -d \
  --name deploy-webhook \
  --env-file .env \
  -p 3000:3000 \
  -v ./deploy.sh:/app/deploy.sh
  --restart always \
  nana4rider/deploy-webhook:latest

Tip

必要な環境変数についてはこちらをご確認ください。

GitHub Actions側の実装

TIMESTAMP=$(date +%s)
SIGNATURE=$(echo -n "$TIMESTAMP" | openssl dgst -sha256 -hmac "$WEBHOOK_SECRET" | awk '{print $2}')
curl -f -X POST "https://deploy-webhook/webhook" \
      -H "X-Signature: $SIGNATURE" \
      -H "X-Timestamp: $TIMESTAMP"

ドキュメント