Skip to content

Deploy

Deploy #101

Workflow file for this run

name: Deploy
on:
workflow_dispatch:
inputs:
debug:
description: "Debug the event payload"
required: false
type: boolean
workflow_run:
workflows: [Build]
types: [completed]
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ github.event.workflow_run.head_branch == 'main' && 'production' || 'staging' }}
if: ${{ github.event.workflow_run.conclusion == 'success' }}
timeout-minutes: 10
steps:
- name: Debug
if: ${{ github.event.inputs.debug == true }}
run: ${{ tojson(github.event) }}
shell: cat {0}
- name: Check out Git repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_branch }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: "npm"
- name: Install Node.js dependencies
run: npm ci
- name: Build & Deploy Worker
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
environment: ${{ github.event.workflow_run.head_branch == 'main' && 'production' || 'staging' }}
vars: |
DISCORD_APP_ID
DISCORD_PUBLIC_KEY
XBOX_USERNAME
secrets: |
DISCORD_TOKEN
XBOX_PASSWORD
env:
DISCORD_APP_ID: ${{ vars.DISCORD_APP_ID }}
DISCORD_PUBLIC_KEY: ${{ vars.DISCORD_PUBLIC_KEY }}
DISCORD_TOKEN: ${{ secrets.DISCORD_TOKEN }}
XBOX_USERNAME: ${{ vars.XBOX_USERNAME }}
XBOX_PASSWORD: ${{ secrets.XBOX_PASSWORD }}
deploy-cancel:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'The triggering workflow failed'
- run: exit 1