Github Actions

Use the tapitalee/ghactions repository to integrate Tapitalee into your GitHub CI/CD workflows.

For a real-world example of these workflows in action, see the bigdemo workflows.

Set up TAPIT_TOKEN secret

All actions require a TAPIT_TOKEN secret to authenticate with Tapitalee.

Create a Deploy Token in Tapitalee:

$ tapit create deploy_token description='github'

Copy the token into a GitHub Secret under Settings > Secrets and variables > Actions > New Repository Secret, naming it TAPIT_TOKEN.


Available Actions

tapitalee/ghactions/setup-tapit

Installs the Tapit CLI. Used internally by all other actions — you typically don’t need to call this directly.


tapitalee/ghactions/image-build

Builds a container image using Tapit and pushes it to your image repository. Does not deploy.

InputDescriptionRequired
tapit-tokenDeploy tokenYes
app_nameApp name (defaults to deploy token’s linked app)No
docker_tagDocker tag (defaults to short git SHA)No
dockerfilePath to DockerfileNo
cacheCache mode (gha or ecr)No

tapitalee/ghactions/image-deploy

Builds and deploys a container image. If the image already exists, it creates a deploy from it; otherwise it builds and deploys in one step.

InputDescriptionRequired
tapit-tokenDeploy tokenYes
app_nameApp name (defaults to deploy token’s linked app)No
docker_tagDocker tag (defaults to short git SHA)No
dockerfilePath to DockerfileNo
cacheCache mode (gha or ecr)No

tapitalee/ghactions/create-deploy

Deploys an already-built image — no build step. Use this when you’ve built the image in a prior step or workflow.

InputDescriptionRequired
tapit-tokenDeploy tokenYes
app_nameApp name (defaults to deploy token’s linked app)No
docker_tagDocker tag (defaults to short git SHA)No

tapitalee/ghactions/image-login

Logs Docker into your Tapitalee image repository (ECR). Useful when you want to push images manually using Docker commands.

Outputs repository_url — the ECR repository URL.

InputDescriptionRequired
tapit-tokenDeploy tokenYes
app_nameApp name (defaults to deploy token’s linked app)No

tapitalee/ghactions/create-release

Creates a Tapitalee release record, optionally with release notes, a diff URL, and a release URL.

InputDescriptionRequired
tapit-tokenDeploy tokenYes
app_nameApp name (defaults to deploy token’s linked app)No
docker_tagDocker tag (defaults to short git SHA)No
git_tagGit tag to associate with the releaseNo
release_notesMulti-line release notesNo
diff_urlURL to the diffNo
release_urlURL to the release pageNo

tapitalee/ghactions/create-task

Runs a one-off command (e.g. a database migration) as a Tapitalee task and waits for it to complete.

InputDescriptionRequired
tapit-tokenDeploy tokenYes
commandCommand to runYes
memoryMemory in GB (default: 2)No
cpuCPU in cores (default: 0.25)No
app_nameApp name (defaults to deploy token’s linked app)No
docker_tagDocker tag (defaults to short git SHA)No

tapitalee/ghactions/create-preview

Creates a preview app from the current app.

InputDescriptionRequired
tapit-tokenDeploy tokenYes
preview_app_nameName for the preview appYes
app_nameSource app nameNo
delete_in_daysAuto-delete after this many daysNo
domainDomain to attach to the preview appNo

tapitalee/ghactions/delete-preview

Deletes a preview app.

InputDescriptionRequired
tapit-tokenDeploy tokenYes
preview_app_nameName of the preview app to deleteYes
app_nameSource app nameNo

tapitalee/ghactions/wait-for-addons

Waits until all add-ons for an app are ready. Useful after creating a preview app before deploying to it.

InputDescriptionRequired
tapit-tokenDeploy tokenYes
app_nameApp nameNo

tapitalee/ghactions/await

Polls a tapit command and waits until a condition on all records becomes true. Useful for waiting on deploys, tasks, or other async operations.

InputDescriptionRequired
tapit-tokenDeploy tokenYes
argsArguments to pass to the tapit commandYes
allJSON condition to match on all records, e.g. {"status": "complete"}Yes
app_nameApp nameNo

Example Workflows

Build & Deploy on push to main

# .github/workflows/deploy.yml
name: Deploy

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Build & Deploy
        uses: tapitalee/ghactions/image-deploy@main
        with:
          tapit-token: ${{ secrets.TAPIT_TOKEN }}

Build image only (no deploy)

# .github/workflows/build.yml
name: Build

on:
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Build Image
        uses: tapitalee/ghactions/image-build@main
        with:
          tapit-token: ${{ secrets.TAPIT_TOKEN }}

Build, then deploy separately

Useful when you want to run tests between building and deploying.

# .github/workflows/deploy.yml
name: Build, Test & Deploy

on:
  push:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: tapitalee/ghactions/image-build@main
        with:
          tapit-token: ${{ secrets.TAPIT_TOKEN }}

  deploy:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: tapitalee/ghactions/create-deploy@main
        with:
          tapit-token: ${{ secrets.TAPIT_TOKEN }}

Run a task (e.g. database migration)

# .github/workflows/migrate.yml
name: Run Migration

on:
  workflow_dispatch:
    inputs:
      command:
        description: 'Command to run'
        required: true
        type: string

jobs:
  migrate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Run Task
        uses: tapitalee/ghactions/create-task@main
        with:
          tapit-token: ${{ secrets.TAPIT_TOKEN }}
          command: ${{ inputs.command }}