Deploy action for GitHub
The deploy API and the deploy action are in preview and not yet released. Names and shapes may change before they are generally available.
The deploy action runs the Autessa CDK in GitHub Actions. It comments a diff on each pull request, and deploys when the change lands on main.
The action runs the same engine as npx autessa-cdk from @autessa/cdk, so it loads projects written as autessa.config.ts or autessa.yaml. For Java projects it runs the Maven or Gradle plugin instead (see Java projects). For Python projects, run autessa-cdk in a workflow step (see Commands).
Quickstart
- Ask a company admin for two deploy keys per stage, created in Autessa under Settings → Deploy keys:
- a preview key with only Preview changes, for pull requests. Save it as a repository secret, for example
AUTESSA_PREVIEW_KEY_DEVandAUTESSA_PREVIEW_KEY_PROD. - a deploy key with Preview changes and Deploy, for merges. Create GitHub environments
devandproduction(limit them tomain, and add required reviewers if you want them), and save the key as an environment secret:AUTESSA_DEPLOY_KEY_DEVindev,AUTESSA_DEPLOY_KEY_PRODinproduction.
- a preview key with only Preview changes, for pull requests. Save it as a repository secret, for example
- Each job puts its key in the variable your
autessa.stages.yamlnames indeployKeyEnv. - Add the workflow below.
# .github/workflows/autessa-deploy.yml
name: Autessa deploy
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
jobs:
# Pull requests: preview only, with "Preview changes" keys (repository secrets).
preview:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
concurrency:
group: autessa-preview-${{ github.ref }}
cancel-in-progress: true
env:
AUTESSA_DEPLOY_KEY_DEV: ${{ secrets.AUTESSA_PREVIEW_KEY_DEV }}
AUTESSA_DEPLOY_KEY_PROD: ${{ secrets.AUTESSA_PREVIEW_KEY_PROD }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 24 }
- run: npm ci # only needed for autessa.config.ts projects
- uses: Autessa-Inc/autessa-deploy-action@v0
with:
command: diff
stages: dev,prod
# Merges to main: deploy each stage with its "Deploy" key, kept in a GitHub environment.
deploy-dev:
if: github.event_name == 'push'
runs-on: ubuntu-latest
environment: dev
concurrency:
group: autessa-deploy-dev
cancel-in-progress: false
env:
AUTESSA_DEPLOY_KEY_DEV: ${{ secrets.AUTESSA_DEPLOY_KEY_DEV }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 24 }
- run: npm ci
- uses: Autessa-Inc/autessa-deploy-action@v0
with:
command: deploy
stages: dev
deploy-prod:
needs: deploy-dev
runs-on: ubuntu-latest
environment: production
concurrency:
group: autessa-deploy-prod
cancel-in-progress: false
env:
AUTESSA_DEPLOY_KEY_PROD: ${{ secrets.AUTESSA_DEPLOY_KEY_PROD }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: 24 }
- run: npm ci
- uses: Autessa-Inc/autessa-deploy-action@v0
with:
command: deploy
stages: prod
Why split the keys: a pull request job runs code from the branch (including npm ci scripts), so it only gets a key that can look, not change. Environment secrets reach only jobs that name the environment, and those run only on pushes to main. concurrency makes a second merge wait for the first deploy to a stage instead of racing it.
On a pull request, the action posts a diff comment and updates it in place on every push. On a merge, it deploys dev, then prod. If a stage fails, the run stops there.
Each deploy shows up on the company's Deployments page in Autessa with the repository, the commit and a link to the workflow run, so you can go from a deployment back to the change that made it. See Watch deployments.
Refusals
A deploy stops after the preview, and fails the step, when a change:
- widens access (marked
WIDENS ACCESS), unlessallow-widen: true; - costs money, such as buying a phone number (marked
WILL PURCHASE), unlessallow-purchase: trueand the stage setsallowPhonePurchase: true; - takes over a resource already in the tenant (marked
ADOPT), unlessadopt: true; - drops columns and their data (marked
DELETES DATA), unlessallow-destructive: true.
Set these only in a workflow that a person reviews, for example after a pull request with the diff comment is approved.
Java projects
With build-tool: auto (the default), the action picks the Node CDK when the folder has autessa.config.* or autessa.yaml, else the Maven plugin when it has pom.xml, else the Gradle plugin when it has build.gradle.kts or build.gradle. The job needs Java:
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with: { distribution: temurin, java-version: 21, cache: maven }
- uses: Autessa-Inc/autessa-deploy-action@v0
with:
command: ${{ github.event_name == 'pull_request' && 'diff' || 'deploy' }}
stages: dev,prod
The project's wrapper (./mvnw, ./gradlew) is used when it has one, and the inputs become the plugin's autessa.* properties.
Inputs
| Input | Default | What it does |
|---|---|---|
command | diff | diff previews. deploy applies. |
stages | Comma-separated stage names from autessa.stages.yaml, run in order. | |
fanout | Comma-separated fan-out groups. Each one runs against every tenant in the group. | |
deploy-key | A deploy key for any stage whose deployKeyEnv variable is not set. | |
working-directory | . | The folder with autessa.config.ts, autessa.yaml, pom.xml or build.gradle(.kts). |
build-tool | auto | auto, node, maven or gradle. |
prune | false | When deploying, also delete resources removed from the project. |
allow-widen | false | Deploy even when a change widens access. |
allow-purchase | false | Deploy even when a change costs money. The stage must also set allowPhonePurchase: true. |
adopt | false | Take over resources already in the tenant under the project's names. |
allow-destructive | false | Delete the columns the project dropped, with their data. |
fail-on-widen | false | On diff: fail the check when any change widens access. |
skip-build | false | Don't build app folders (Node projects only). |
comment-on-pr | true | Post or update the diff comment on pull requests. |
github-token | ${{ github.token }} | Used to comment. Needs pull-requests: write. |
base-url | Override the API base URL. The default is https://api.autessa.com. |
Each stage reads its key from the environment variable named by deployKeyEnv in autessa.stages.yaml, then from deploy-key, then from AUTESSA_DEPLOY_KEY. Keys are masked in logs.
Outputs
| Output | What it holds |
|---|---|
summary | The diff as markdown. Also written to the job summary. |
changes | JSON, one entry per tenant with its summary, changes and deployment. |
widens | true when any change widens access. |
purchases | true when any change costs money. |
deployment-ids | JSON array of deployment IDs (deploy only). |
passed | true when every step succeeded. |
reason | Why the step ended: ok, error, usage, widens_access, purchase_not_allowed, adopt_not_allowed, destructive_not_allowed or checks_failed. |
exit-code | The exit code for reason, the same as the command line's. The step exits with it. |
Versions
The action runs on Node 24. @v0 follows the newest v0.x.y release. Pin @v0.1.0, or a commit, to stay on one version.
Tips
- Set
fail-on-widen: trueon pull requests, or require a review on pull requests whose diff containsWIDENS ACCESS. - Add the eval action before deploy to block releases that fail your attack simulation or grading threshold.
- Prefer Autessa Pipelines if you want promotion rules and run history inside Autessa.
Example
A full project with ready-to-copy workflows (deploy.yml.example) for TypeScript and Java: autessa-as-code-tenant.