GitHub Actions example
This simple GitHub action workflow will deploy your Trigger.dev tasks when new code is pushed to themain
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.
Creating a Personal Access Token
1
Create a new access token
Go to your profile page and click on the “Personal Access
Tokens” tab.
2
Go to your repository on GitHub.
Click on ‘Settings’ -> ‘Secrets and variables’ -> ‘Actions’ -> ‘New repository secret’
3
Add the TRIGGER_ACCESS_TOKEN
Add the name 
TRIGGER_ACCESS_TOKEN
and the value of your access token. 
CLI Version pinning
The CLI and@trigger.dev/*
package versions need to be in sync with the trigger.dev
CLI, otherwise there will be errors and unpredictable behavior. Hence, the deploy
command will automatically fail during CI on any version mismatches.
Tip: add the trigger.dev
CLI to your devDependencies
and the deploy command to your package.json
file to keep versions managed in the same place. For example:
package.json
script, like so:
.github/workflows/release-trigger.yml
--version
to any command.
Self-hosting
When self-hosting, you will have to take a few additional steps:- Specify the
TRIGGER_API_URL
environment variable. You can add it to the GitHub secrets the same way as the access token. This should point at your webapp domain, for example:https://trigger.example.com
- Setup docker as you will need to build and push the image to your registry. On Trigger.dev Cloud this is all done remotely.
- Add your registry credentials to the GitHub secrets.
- Use the
--self-hosted
and--push
flags when deploying.
If you’re self-hosting v4, the
--self-hosted
and --push
flags are NOT needed.