Skip to main content

GitHub Actions Reference

Skiff2 provides reusable GitHub Actions for building and deploying your services. All actions are hosted in the allenai/skiff2-actions repo and pinned to @main.

Variables​

After your project is provisioned, these GitHub Actions variables are automatically set on your repo:

VariableDescription
SKIFF2_PROJECT_IDYour GCP project ID
SKIFF2_WORKLOAD_IDENTITY_PROVIDERWorkload Identity Federation provider for keyless GCP auth
SKIFF2_SERVICE_ACCOUNTService account email used for GCP operations

setup action​

Path: allenai/skiff2-actions/shared-actions/setup@main

Authenticates to Google Cloud and configures Docker for Container Registry. Must run before build or deploy.

Inputs​

InputRequiredDefaultDescription
workload_identity_providerYes—Workload Identity Provider resource name
service_accountYes—Service account email to impersonate
project_idYes—GCP project ID

Example​

- name: Skiff2 Setup
id: setup
uses: allenai/skiff2-actions/shared-actions/setup@main
with:
workload_identity_provider: ${{ vars.SKIFF2_WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ vars.SKIFF2_SERVICE_ACCOUNT }}
project_id: ${{ vars.SKIFF2_PROJECT_ID }}

build action​

Path: allenai/skiff2-actions/shared-actions/build@main

Builds Docker images for each service defined in skiff2.json and pushes them to GCR.

Inputs​

InputTypeRequiredDefaultDescription
project_idStringYes—GCP project ID
config_fileStringNoskiff2.jsonPath to config file relative to repo root
registryStringNogcr.ioDocker registry
regionStringNous-west1GCP region
repo_nameStringNogithub.event.repository.nameRepository name for image tagging
commit_shaStringNogithub.shaCommit SHA to tag images with
branch_nameStringNogithub.ref_nameBranch name to tag images with
servicesCSVNo(all services)Comma-separated list of service names to build
build_argsListNo-List of build-time variables
secretsListNo—Build-time secrets to expose (key=${{ secrets.VALUE }}, one per line). Passed as --secret id=key to docker buildx. Use RUN --mount=type=secret,id=key in your Dockerfile.
secret_envsList/CSVNo—Build-time secrets sourced from runner environment variables (key=ENV_VAR_NAME, one per line). The env var must already be set in the job environment.
secret_filesListNo—Build-time secrets sourced from files (key=./path/to/file, one per line). Passed as --secret id=key,src=file.
pushBooleanNotruePushes the built artifacts to a registry
cache_fromStringNotype=registry,ref=${DOCKER_REGISTRY}/${PROJECT_ID}/${SERVICE_NAME}:${BRANCH}-buildcacheList of external cache sources for buildx (e.g., user/app:cache, type=local,src=path/to/dir). Replaces ${DOCKER_REGISTRY}, ${PROJECT_ID}, ${SERVICE_NAME}, ${BRANCH} with corresponding values.
cache_toStringNotype=registry,ref=${DOCKER_REGISTRY}/${PROJECT_ID}/${SERVICE_NAME}:${BRANCH}-buildcache,mode=maxList of cache export destinations for buildx (e.g., user/app:cache, type=local,dest=path/to/dir). Replaces ${DOCKER_REGISTRY}, ${PROJECT_ID}, ${SERVICE_NAME}, ${BRANCH} with corresponding values.

Input Types​

List type is a newline-delimited string

cache-from: |
user/app:cache
type=local,src=path/to/dir

CSV type is a comma-delimited string

tags: name/app:latest,name/app:1.0.0

Outputs​

OutputDescription
built-imagesJSON object mapping service names to their built image tags

Example​

- name: Skiff2 Build
id: build
uses: allenai/skiff2-actions/shared-actions/build@main
with:
project_id: ${{ vars.SKIFF2_PROJECT_ID }}

deploy-infra action​

Path: allenai/skiff2-actions/shared-actions/deploy-infra@main

Deploys shared infrastructure (load balancer, URL map, NEGs, SSL certificates) for all environments. Only needs to run on main branch pushes. This action should NOT be included in the deploy workflow for remoteRepos listed in the project config.

Inputs​

InputRequiredDefaultDescription
project_idYes—GCP project ID
commandNoplanplan or apply
config_fileNoskiff2.jsonPath to config file relative to repo root
regionNous-west1GCP region
repo_nameNogithub.event.repository.nameRepository name

Outputs​

OutputDescription
default_urlDefault load balancer URL for the project

Example​

- name: Skiff2 Deploy Infra
if: github.ref_name == 'main'
uses: allenai/skiff2-actions/shared-actions/deploy-infra@main
with:
project_id: ${{ vars.SKIFF2_PROJECT_ID }}
command: apply

deploy-services action​

Path: allenai/skiff2-actions/shared-actions/deploy-services@main

Deploys Cloud Run services for a single environment. Uses Terraform workspaces for branch isolation — main branch uses the default workspace, other branches get their own workspace.

Inputs​

InputRequiredDefaultDescription
project_idYes—GCP project ID
commandNoplanplan or apply
config_fileNoskiff2.jsonPath to config file relative to repo root
regionNous-west1GCP region
repo_nameNogithub.event.repository.nameRepository name
environmentNogithub.ref_nameTarget environment to deploy (e.g. main, qa)
servicesNo(all services)Comma-separated list of services to deploy

Outputs​

OutputDescription
default_urlDefault load balancer URL for the project

Example​

- name: Skiff2 Deploy Services
id: deploy-services
uses: allenai/skiff2-actions/shared-actions/deploy-services@main
with:
project_id: ${{ vars.SKIFF2_PROJECT_ID }}
command: apply

Full workflow example​

A typical deployment workflow for a project with a single service:

.github/workflows/deploy.yml
name: Skiff2 Build & Deploy
on:
push:
branches:
- main # will need to add more branches here if you plan on deploying to other environments.

# needed to authenticate with google
permissions:
contents: read
id-token: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false

jobs:
build_deploy:
runs-on: ubuntu-latest
environment:
name: ${{ github.ref_name }}
url: ${{ steps.deploy-services.outputs.default_url }}
steps:
- name: Skiff2 Setup
id: setup
uses: allenai/skiff2-actions/shared-actions/setup@main
with:
workload_identity_provider: ${{ vars.SKIFF2_WORKLOAD_IDENTITY_PROVIDER }} # prepopulated on project setup
service_account: ${{ vars.SKIFF2_SERVICE_ACCOUNT }} # prepopulated on project setup
project_id: ${{ vars.SKIFF2_PROJECT_ID }} # prepopulated on project setup

- name: Skiff2 Build
id: build
uses: allenai/skiff2-actions/shared-actions/build@main
with:
project_id: ${{ vars.SKIFF2_PROJECT_ID }}

- name: Skiff2 Deploy Infra
if: github.ref_name == 'main'
uses: allenai/skiff2-actions/shared-actions/deploy-infra@main
with:
project_id: ${{ vars.SKIFF2_PROJECT_ID }}
command: apply

- name: Skiff2 Deploy Services
id: deploy-services
uses: allenai/skiff2-actions/shared-actions/deploy-services@main
with:
project_id: ${{ vars.SKIFF2_PROJECT_ID }}
command: apply