Skip to content

Deploy with Trigger.dev #12

Deploy with Trigger.dev

Deploy with Trigger.dev #12

Workflow file for this run

name: Deploy with Trigger.dev
on:
workflow_dispatch:
inputs:
environment:
description: 'Select the deployment environment'
type: 'choice'
required: true
default: 'staging'
options:
- prod
- staging
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
# Automatically checkout the same branch/tag from "Use workflow from" dropdown
ref: ${{ github.ref_name }}
- name: Setup Node.JS v20
uses: actions/setup-node@v4
with:
node-version: '20.x'
# Dynamically set TRIGGER_SECRET_KEY from the correct secrets based on whether 'prod' or 'staging' was chosen.
- name: Configure environment variables
run: |
if [ "${{ github.event.inputs.environment }}" = "prod" ]; then
echo "TRIGGER_SECRET_KEY=${{ secrets.TRIGGER_SECRET_KEY_PROD }}" >> $GITHUB_ENV
else
echo "TRIGGER_SECRET_KEY=${{ secrets.TRIGGER_SECRET_KEY_STAGING }}" >> $GITHUB_ENV
fi
# TRIGGER_ACCESS_TOKEN (same for both)
echo "TRIGGER_ACCESS_TOKEN=${{ secrets.TRIGGER_ACCESS_TOKEN }}" >> $GITHUB_ENV
- name: Install build dependencies
run: yarn add "@trigger.dev/[email protected]" "@trigger.dev/[email protected]"
- name: Run deploy command
run: npx [email protected] deploy -e ${{ github.event.inputs.environment }}