Deploy from GitHub Actions
The Suta action plans your suta.yaml on each pull request and comments the
plan, so reviewers see which devices change before anyone merges. After the
merge, it deploys exactly what was reviewed and waits for the rollout to
finish.
Before you begin
Section titled “Before you begin”- Commit
suta.yamland thesuta.lockthatsuta planwrites beside it. - Create an API token with the Operator role or another role that can deploy.
- In your repository, go to Settings > Secrets and variables >
Actions and add the token as a secret named
SUTA_TOKEN.
Add the workflow
Section titled “Add the workflow”-
Create
.github/workflows/suta.yml:name: Sutaon:pull_request:paths: [suta.yaml, suta.lock]push:branches: [main]paths: [suta.yaml, suta.lock]concurrency:group: suta-${{ github.ref }}jobs:plan:if: github.event_name == 'pull_request'runs-on: ubuntu-latestpermissions:contents: readpull-requests: writesteps:- uses: actions/checkout@v4- uses: suta-dev/suta/action@mainwith:command: plantoken: ${{ secrets.SUTA_TOKEN }}deploy:if: github.event_name == 'push'runs-on: ubuntu-latestpermissions:contents: readsteps:- uses: actions/checkout@v4- uses: suta-dev/suta/action@mainwith:command: deploytoken: ${{ secrets.SUTA_TOKEN }}message: ${{ github.event.head_commit.message }} -
Open a pull request that changes
suta.yaml. The plan job comments the plan on the pull request and updates the same comment on every push. -
Merge the pull request. The deploy job plans again from the committed
suta.lock, starts the rollout and waits. It fails if the rollout pauses, is cancelled or any device fails, so the failed run shows on the commit.
Both jobs fail when suta.lock is missing or out of date, because the deploy
would then pin images or versions nobody reviewed. Run suta plan locally and
commit suta.lock to fix it. To move to newer images, run suta plan --update
and commit the new lock in the pull request.
Inputs
Section titled “Inputs”| Input | Default | Description |
|---|---|---|
command |
required | plan comments the plan on the pull request. deploy plans and rolls out, then waits. |
token |
required | The Suta API token. |
file |
suta.yaml |
The suta.yaml to plan. Its suta.lock sits beside it. |
tags |
all | Only devices with these tags, one per line. |
sites |
all | Only devices in these sites, one per line. |
devices |
all | Only these device names or IDs, one per line. |
message |
none | What the deploy is for. It names the plan and its rollout. Only the first line is used, so a commit message works. |
canary |
suits the fleet | Devices to update first, from 0 to 20. |
batch |
suits the fleet | Devices to update at a time after the canary, from 1 to 500. |
max-failures |
0 |
Failures to allow before the rollout pauses, from 0 to 100. |
github-token |
github.token |
Posts the plan comment. It needs pull-requests: write. |
The action sets the plan-id output to the plan it commented or deployed.
Follow a rollout with suta rollout list or in the dashboard under
Deployments.
To deploy several projects from one repository, run the action once per
suta.yaml with file. Each file gets its own comment.