Skip to main content

Deploy action for GitHub

Preview

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​

  1. 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_DEV and AUTESSA_PREVIEW_KEY_PROD.
    • a deploy key with Preview changes and Deploy, for merges. Create GitHub environments dev and production (limit them to main, and add required reviewers if you want them), and save the key as an environment secret: AUTESSA_DEPLOY_KEY_DEV in dev, AUTESSA_DEPLOY_KEY_PROD in production.
  2. Each job puts its key in the variable your autessa.stages.yaml names in deployKeyEnv.
  3. 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), unless allow-widen: true;
  • costs money, such as buying a phone number (marked WILL PURCHASE), unless allow-purchase: true and the stage sets allowPhonePurchase: true;
  • takes over a resource already in the tenant (marked ADOPT), unless adopt: true;
  • drops columns and their data (marked DELETES DATA), unless allow-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​

InputDefaultWhat it does
commanddiffdiff previews. deploy applies.
stagesComma-separated stage names from autessa.stages.yaml, run in order.
fanoutComma-separated fan-out groups. Each one runs against every tenant in the group.
deploy-keyA 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-toolautoauto, node, maven or gradle.
prunefalseWhen deploying, also delete resources removed from the project.
allow-widenfalseDeploy even when a change widens access.
allow-purchasefalseDeploy even when a change costs money. The stage must also set allowPhonePurchase: true.
adoptfalseTake over resources already in the tenant under the project's names.
allow-destructivefalseDelete the columns the project dropped, with their data.
fail-on-widenfalseOn diff: fail the check when any change widens access.
skip-buildfalseDon't build app folders (Node projects only).
comment-on-prtruePost or update the diff comment on pull requests.
github-token${{ github.token }}Used to comment. Needs pull-requests: write.
base-urlOverride 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​

OutputWhat it holds
summaryThe diff as markdown. Also written to the job summary.
changesJSON, one entry per tenant with its summary, changes and deployment.
widenstrue when any change widens access.
purchasestrue when any change costs money.
deployment-idsJSON array of deployment IDs (deploy only).
passedtrue when every step succeeded.
reasonWhy the step ended: ok, error, usage, widens_access, purchase_not_allowed, adopt_not_allowed, destructive_not_allowed or checks_failed.
exit-codeThe 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: true on pull requests, or require a review on pull requests whose diff contains WIDENS 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.