Skip to content

actions: alert on deployment failure (#341) #303

actions: alert on deployment failure (#341)

actions: alert on deployment failure (#341) #303

Workflow file for this run

name: Deploy Worker
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
name: Deploy Cloudflare Worker
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: step-security/harden-runner@446798f8213ac2e75931c1b0769676d927801858
with:
egress-policy: audit
- name: Git Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'npm'
- name: Install Dependencies
run: npm install
- name: Deploy to Staging
if: github.event_name == 'push'
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
command: deploy --env staging
- name: Deploy to Production
if: github.event_name == 'workflow_dispatch'
uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
command: deploy --env prod
- name: Alert on Failure
if: failure() && github.repository == 'nodejs/release-cloudflare-worker'
runs-on: ubuntu-latest
steps:
- name: Slack Notification
uses: rtCamp/action-slack-notify@c33737706dea87cd7784c687dadc9adf1be59990 # 2.3.2
env:
SLACK_COLOR: '#DE512A'
SLACK_ICON: https://github.com/nodejs.png?size=48
SLACK_TITLE: Deployment failed (${{ github.ref }})
SLACK_MESSAGE: |
A deployment of the Release Worker has failed.
SLACK_USERNAME: nodejs-bot
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}