Skip to main content

Deploy an App from CI

A deploy credential lets a CI job, such as GitHub Actions, publish new releases of one hosted app. It cannot reach any other app, change the app's settings, read your data or call any other Custd route. It acts for the person who created it, so if that person loses access to the app, its deploys stop too.

Before you start​

You need:

1. Create the credential​

custdctl apps credentials create --app done-when

It prints a client_id and a client_secret. The secret is shown once. Store both in your CI's secret store, for example as the GitHub Actions secrets CUSTD_DEPLOY_CLIENT_ID and CUSTD_DEPLOY_CLIENT_SECRET. Never put the secret in the repository.

2. Deploy from CI​

The job signs in with the credential, then deploys the built folder. The token is short-lived and minted on each run; the secret is read from the environment and never written to disk.

name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci && npm run build
- name: Install custdctl
run: |
curl -fsSL -o custdctl https://github.com/haakco/custd-downloads/releases/latest/download/custdctl-linux-amd64
chmod +x custdctl
- name: Deploy
env:
CUSTD_DEPLOY_CLIENT_SECRET: ${{ secrets.CUSTD_DEPLOY_CLIENT_SECRET }}
run: |
./custdctl config init --profile ci --api-url "https://custd.com" \
--issuer-url "https://auth.custd.com/" --client-id "${{ secrets.CUSTD_DEPLOY_CLIENT_ID }}" \
--audience "custd" --scope "apps.releases.write"
./custdctl auth token --profile ci --client-secret-env CUSTD_DEPLOY_CLIENT_SECRET
./custdctl apps deploy ./dist --profile ci --app done-when

Each deploy is named after the commit it was built from (short SHA and subject), so the release list shows which commit is live. Custd keeps the live release and the newest ten.

Rotate or remove a credential​

Delete a credential you no longer use; its next token request fails at once:

custdctl apps credentials delete app-deploy-done-when-0123456789ab --app done-when

To rotate, create a new credential, update the CI secrets, then delete the old one.

What a refusal means​

  • 403 on deploy: the credential is not bound to this app, was deleted, or the person who created it no longer manages the app. Create a new credential as someone who does.
  • 404: the --app name does not match the credential's app.
  • oauth_client_app_release_scope_reserved: deploy credentials are created and deleted only through custdctl apps credentials (or POST /api/v1/admin/apps/{slug}/deploy-credentials), not through the general credential screens.