GitHub Actions
You can easily deploy your tasks with GitHub actions.
This simple GitHub action file will deploy your Trigger.dev tasks when new code is pushed to the main
branch and the trigger
directory has changes in it.
The deploy step will fail if any version mismatches are detected. Please see the version pinning section for more details.
If you already have a GitHub action file, you can just add the final step ”🚀 Deploy Trigger.dev” to your existing file.
Creating a Personal Access Token
Create a new access token
Go to your repository on GitHub.
Add the TRIGGER_ACCESS_TOKEN
TRIGGER_ACCESS_TOKEN
and the value of your access token. Version pinning
The CLI and @trigger.dev/*
package versions need to be in sync, otherwise there will be errors and unpredictable behavior. Hence, the deploy
command will automatically fail during CI on any version mismatches.
Tip: add the deploy command to your package.json
file to keep versions managed in the same place. For example:
{
"scripts": {
"deploy:trigger-prod": "npx [email protected] deploy",
"deploy:trigger": "npx [email protected] deploy --env staging"
}
}
Your workflow file will follow the version specified in the package.json
script, like so:
- name: 🚀 Deploy Trigger.dev
env:
TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }}
run: |
npm run deploy:trigger
You should use the version you run locally during dev and manual deploy. The current version is displayed in the banner, but you can also check it by appending --version
to any command.
Was this page helpful?