This simple GitHub action workflow 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.
To deploy to preview branches from Pull Requests and have them archived when PRs are merged or closed, use a workflow that runs on pull_request with all four types including closed:
Include closed in the pull_request.types list. Without it, preview branches won’t be archived when PRs are merged or closed, and you may hit the limit on active preview branches. See Preview branches for more details.
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:
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.