Reusable workflows for NAIS projects using mise for task management.
- β mise-build-deploy-fasit.yaml - Fasit with Helm charts
- π¦ chart-deploy-fasit.yaml - Helm chart only, no app build
- π mise-build-deploy-nais.yaml - Standard NAIS deployment
- π€ dependabot-auto-merge.yaml - Auto-merge Dependabot PRs
- Common Features Β· Prerequisites Β· Best Practices
Fasit platform deployment workflow with Helm chart support.
uses: nais/actions/.github/workflows/mise-build-deploy-fasit.yaml@abc123 # ratchet:nais/actions/.github/workflows/mise-build-deploy-fasit.yaml@main
with:
builds-chart: true
deploys-to-fasit: true
targets: |
[
{ "target": { "kind": "management", "tenant": "ci-nais" }, "wait": true },
{ "target": { "kind": "management" } }
]
secrets:
NAIS_IO_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}Features:
- β Helm chart packaging and publishing
- β Fasit deployment support
- β Single-cluster deployment model
Chart-only deployment to Fasit: lint, package and push a Helm chart, then roll it out. No app build, no Docker image, no mise.
uses: nais/actions/.github/workflows/chart-deploy-fasit.yaml@abc123 # ratchet:nais/actions/.github/workflows/chart-deploy-fasit.yaml@main
with:
targets: |
[ { "target": { "kind": "management" } } ]
secrets:
NAIS_IO_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}Features:
- β Helm chart linting, packaging and publishing
- β Fasit deployment support
- β
No
mise.tomlor build tasks required
Standard NAIS deployment workflow using nais/deploy.
uses: nais/actions/.github/workflows/mise-build-deploy-nais.yaml@abc123 # ratchet:nais/actions/.github/workflows/mise-build-deploy-nais.yaml@main
with:
deploys-to-nais: true
nais-team: my-team
nais-clusters: '["dev-gcp", "prod-gcp"]'
secrets:
NAIS_IO_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}Features:
- β Multi-cluster deployment (dev-gcp, prod-gcp, etc.)
- β Optional PR deployments to dev
- β
Uses
.nais/app.yamlmanifests
Automatically merge non-major Dependabot pull requests.
uses: nais/actions/.github/workflows/dependabot-auto-merge.yaml@abc123 # ratchet:nais/actions/.github/workflows/dependabot-auto-merge.yaml@main
secrets:
DEPENDABOT_AUTO_MERGE_APP_ID: ${{ secrets.DEPENDABOT_AUTO_MERGE_APP_ID }}
DEPENDABOT_AUTO_MERGE_APP_SECRET: ${{ secrets.DEPENDABOT_AUTO_MERGE_APP_SECRET }}Features:
- β Auto-merges patch and minor version updates
- β Skips major version updates (manual review required)
- β Uses squash merge strategy
- β Requires GitHub App authentication
Setup:
- GitHub App: Install the existing NAIS Dependabot auto-merge GitHub App in your repository (contact your GitHub org admin if needed)
- Repository Secrets: Ensure
DEPENDABOT_AUTO_MERGE_APP_IDandDEPENDABOT_AUTO_MERGE_APP_SECRETare available (usually set at org level) - Workflow Permissions: The calling workflow needs
pull-requests: writepermission - Create
.github/workflows/dependabot.yaml:
name: Dependabot
on: pull_request
permissions:
pull-requests: write # Required for the GitHub App to merge PRs
jobs:
auto-merge:
uses: nais/actions/.github/workflows/dependabot-auto-merge.yaml@abc123 # ratchet:nais/actions/.github/workflows/dependabot-auto-merge.yaml@main
secrets:
DEPENDABOT_AUTO_MERGE_APP_ID: ${{ secrets.DEPENDABOT_AUTO_MERGE_APP_ID }}
DEPENDABOT_AUTO_MERGE_APP_SECRET: ${{ secrets.DEPENDABOT_AUTO_MERGE_APP_SECRET }}Both workflows share these capabilities:
- π§ Parallel Quality Checks: Run mise tasks in parallel (lint, test, etc.)
- ποΈ Build Management: Execute your mise build task
- π³ Docker: Build and push to Google Artifact Registry
- π·οΈ Git Tags: Optional automatic tagging
- πΎ Caching: Optimized build caching
- π Security: GCP Workload Identity Federation
Both workflows require a mise.toml with minimum tasks:
[tasks.version]
run = 'echo "$(date +%Y%m%d)-g$(git rev-parse --short HEAD)"'
[tasks.build]
run = "go build -o bin/app ./cmd/app"Recommended - add quality checks:
[tasks.lint]
run = "golangci-lint run"
[tasks.test]
run = "go test -race ./..."Configure which tasks to run:
with:
mise-tasks: '["lint", "test"]'Deploy to Fasit with Helm chart support.
name: Build and Deploy
on:
push:
branches: [main]
permissions:
contents: read
id-token: write
jobs:
deploy:
uses: nais/actions/.github/workflows/mise-build-deploy-fasit.yaml@abc123 # ratchet:nais/actions/.github/workflows/mise-build-deploy-fasit.yaml@main
with:
builds-chart: true
deploys-to-fasit: true
chart-path: './charts'
mise-tasks: '["lint", "test"]'
targets: |
[
{ "target": { "kind": "management", "tenant": "ci-nais" }, "wait": true },
{ "target": { "kind": "management" } }
]
secrets:
NAIS_IO_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}| Input | Description | Default |
|---|---|---|
builds-chart |
Build Helm chart | false |
deploys-to-fasit |
Deploy to Fasit | false |
deploy-pr-targets |
PR deploy targets (enables PR deploys when set) | "" |
chart-path |
Helm chart directory | ./charts |
chart-repo |
Chart repository | nais-io/nais/charts |
working-directory |
Working directory for monorepo support | . |
mise-setup-tasks |
Setup tasks to run before checks (e.g., install) | [] |
mise-tasks |
Quality check tasks | ["tidy-check", "fmt-check", "lint", "vet", "check", "test-race"] |
mise-task-build |
Build task name | build |
mise-task-version |
Version task name | version |
- Helm Chart: Create chart in
./charts/{repo-name}/ - GCP Service Account:
gh-{repo-name}@nais-io.iam.gserviceaccount.com - Workload Identity: Configure federation
Chart-only deployment to Fasit. Use this when the repository contains just a Helm chart (e.g. PrometheusRules or other cluster YAML) and there is no application to build.
name: Deploy chart
on:
push:
branches: [main]
permissions:
contents: read
id-token: write
jobs:
deploy:
uses: nais/actions/.github/workflows/chart-deploy-fasit.yaml@abc123 # ratchet:nais/actions/.github/workflows/chart-deploy-fasit.yaml@main
with:
targets: |
[ { "target": { "kind": "management" } } ]
secrets:
NAIS_IO_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}| Input | Description | Default |
|---|---|---|
chart-path |
Helm chart directory | ./charts |
chart-name |
Chart dir under chart-path, and OCI chart ref | repository name |
chart-repo |
Chart repository | nais-io/nais/charts |
artifact-registry |
OCI registry for charts | europe-north1-docker.pkg.dev |
helm-version |
Helm version to use | v3.16.3 |
release-branch |
Branch that triggers Fasit rollout on push | main |
targets |
Inline JSON array of {target, wait} entries | "" |
targets-file |
Path to a JSON file with targets (mutually exclusive with targets) |
"" |
| Output | Description |
|---|---|
version |
Generated version string |
release |
Helm chart name |
- Helm Chart: Create chart in
./charts/{chart-name}/(defaults to the repository name). Thenamein Chart.yaml must match, since the rollout pullsoci://{artifact-registry}/{chart-repo}/{chart-name}- the workflow fails fast on a mismatch. - GCP Service Account:
gh-{repo-name}@nais-io.iam.gserviceaccount.com - Workload Identity: Configure federation
The chart is linted and packaged on every run, but only pushed when GCP authentication succeeds, so Dependabot and fork PRs only validate the chart. Rollout happens on pushes to release-branch.
Deploy to NAIS clusters using standard nais/deploy.
name: Build and Deploy
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
id-token: write
jobs:
deploy:
uses: nais/actions/.github/workflows/mise-build-deploy-nais.yaml@abc123 # ratchet:nais/actions/.github/workflows/mise-build-deploy-nais.yaml@main
with:
deploys-to-nais: true
nais-team: my-team
nais-clusters: '["dev-gcp", "prod-gcp"]'
mise-tasks: '["lint", "test"]'
secrets:
NAIS_IO_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}| Input | Description | Default |
|---|---|---|
deploys-to-nais |
Enable NAIS deployment | false |
nais-clusters |
JSON array of clusters | ["dev-gcp"] |
nais-team |
Team name | nais |
nais-resource |
Path to app manifest | .nais/app.yaml |
nais-vars |
Path to cluster vars (use {cluster} placeholder) |
.nais/{cluster}.yaml |
deploy-pr-to-dev |
Deploy PRs to dev | false |
working-directory |
Working directory for monorepo support | . |
mise-setup-tasks |
Setup tasks to run before checks (e.g., install) | [] |
mise-tasks |
Quality check tasks | ["tidy-check", "fmt-check", "lint", "vet", "check", "test-race"] |
mise-task-build |
Build task name | build |
mise-task-version |
Version task name | version |
- NAIS Manifests: Create
.nais/app.yamland cluster-specific vars- For multi-cluster:
.nais/dev-gcp.yaml,.nais/prod-gcp.yaml, etc. - The
{cluster}placeholder innais-varsis automatically replaced with each cluster name
- For multi-cluster:
- GCP Service Account:
gh-{repo-name}@nais-io.iam.gserviceaccount.com - Workload Identity: Configure federation
With PR deployments:
with:
deploys-to-nais: true
deploy-pr-to-dev: true
nais-team: my-teamCustom manifests and vars pattern:
with:
deploys-to-nais: true
nais-resource: '.nais/nais.yaml'
nais-vars: '.nais/vars-{cluster}.yaml' # Becomes .nais/vars-dev-gcp.yaml, .nais/vars-prod-gcp.yaml, etc.Same vars file for all clusters:
with:
deploys-to-nais: true
nais-vars: '.nais/common-vars.yaml' # No {cluster} placeholder = same file for allBoth workflows share these inputs:
| Input | Description | Default |
|---|---|---|
builds-docker |
Build Docker image | true |
dockerfile-path |
Path to Dockerfile | ./Dockerfile |
docker-context |
Build context | . |
creates-git-tag |
Create git tag (requires contents: write permission) |
false |
artifact-registry |
Registry URL | europe-north1-docker.pkg.dev |
artifact-repo |
Repository path | nais-io/nais/images |
runner-size |
Runner size | ubuntu-latest |
runner-size-docker |
Docker runner size | ubuntu-latest |
working-directory |
Working directory for monorepo support | . |
| Output | Description |
|---|---|
version |
Generated version string |
name |
Repository name |
image |
Full image reference with tag |
Both workflows support monorepo setups via the working-directory input. This allows you to run all mise tasks, builds, and deployments from within a specific subdirectory:
jobs:
service-a:
uses: nais/actions/.github/workflows/mise-build-deploy-nais.yaml@abc123 # ratchet:nais/actions/.github/workflows/mise-build-deploy-nais.yaml@main
with:
working-directory: 'apps/service-a'
deploys-to-nais: true
nais-team: my-team
secrets:
NAIS_IO_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}
service-b:
uses: nais/actions/.github/workflows/mise-build-deploy-fasit.yaml@abc123 # ratchet:nais/actions/.github/workflows/mise-build-deploy-fasit.yaml@main
with:
working-directory: 'apps/service-b'
builds-chart: true
deploys-to-fasit: true
targets: |
[
{ "target": { "kind": "management", "tenant": "ci-nais" }, "wait": true },
{ "target": { "kind": "management" } }
]
secrets:
NAIS_IO_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}Monorepo Structure Example:
.
βββ apps/
β βββ service-a/
β β βββ mise.toml
β β βββ Dockerfile
β β βββ .nais/
β β βββ app.yaml
β β βββ dev-gcp.yaml
β βββ service-b/
β βββ mise.toml
β βββ Dockerfile
β βββ charts/
β βββ service-b/
βββ .github/
βββ workflows/
βββ build.yaml
Important: When using working-directory:
- The
mise.tomlmust be in the working directory - Docker paths (
dockerfile-path,docker-context) are relative to the working directory - NAIS manifests and Helm charts should be in the working directory
- Each service in the monorepo should have its own
mise.toml
-
Pin to commit SHA: Use Ratchet for automatic SHA management
uses: nais/actions/.github/workflows/mise-build-deploy-nais.yaml@abc123 # ratchet:nais/actions/.github/workflows/mise-build-deploy-nais.yaml@main
-
Minimal permissions:
permissions: contents: read id-token: write
-
Customize mise tasks: Only run what you need
with: mise-tasks: '["lint", "test"]'
-
Use Ratchet or Dependabot: Keep workflow references updated
-
Monorepo best practices:
- Keep each service's configuration in its own directory
- Use path filters to trigger workflows only when specific services change
- Consider using a matrix strategy for multiple services with similar configurations
Authentication failures:
- Verify
NAIS_IO_WORKLOAD_IDENTITY_PROVIDERsecret exists - Confirm GCP service account name matches pattern
- Check Workload Identity Federation configuration
Missing mise tasks:
- Ensure all tasks in
mise-tasksare defined inmise.toml - Run
mise taskslocally to verify
Docker build failures:
- Verify
dockerfile-pathis correct - Check
docker-contextcontains required files
- π Report a bug
- π‘ Request a feature
- π¬ Discussions
MIT License - see LICENSE file.
- A
versiontask (generates a version string) - A
buildtask (builds your project) - Optional: quality check tasks (lint, test, etc.)
Minimal Example:
[tasks.version]
description = "Generate version string"
run = 'echo "$(date +%Y%m%d)-g$(git rev-parse --short HEAD)"'
[tasks.build]
description = "Build the application"
run = "go build -o bin/app ./cmd/app"With Quality Checks (Recommended):
[tasks.version]
run = 'echo "$(date +%Y%m%d)-g$(git rev-parse --short HEAD)"'
[tasks.lint]
run = "golangci-lint run"
[tasks.test]
run = "go test -race ./..."
[tasks.build]
run = "go build -o bin/app ./cmd/app"Multi-language Example (Go + TypeScript):
[tasks.version]
run = 'echo "$(date +%Y%m%d)-g$(git rev-parse --short HEAD)"'
# Setup tasks - run before checks
[tasks."install:ts"]
run = "pnpm install --frozen-lockfile"
# Quality checks
[tasks."lint:go"]
run = "golangci-lint run"
[tasks."lint:ts"]
run = "pnpm run lint"
[tasks."test:go"]
run = "go test ./..."
[tasks."test:ts"]
run = "pnpm run test"
[tasks.build]
run = "go build -o bin/app ./cmd/app && pnpm run build"Then configure the workflow:
with:
mise-setup-tasks: '["install:ts"]' # Runs first
mise-tasks: '["lint:go", "lint:ts", "test:go", "test:ts"]' # Run in parallelCreate a workflow file in your repository (e.g., .github/workflows/build.yaml):
name: Build and Deploy
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
id-token: write
jobs:
build:
uses: nais/actions/.github/workflows/mise-build-deploy-fasit.yaml@abc123def456 # ratchet:nais/actions/.github/workflows/mise-build-deploy-fasit.yaml@main
secrets:
NAIS_IO_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}Note: Replace
abc123def456with the actual commit SHA you want to pin to. Using Ratchet will automatically manage these SHA pins for you.
jobs:
build:
uses: nais/actions/.github/workflows/mise-build-deploy-fasit.yaml@main
with:
mise-tasks: '["tidy-check", "fmt-check", "lint", "vet", "test"]'
mise-task-build: 'build-production'
mise-task-version: 'semantic-version'
secrets:
NAIS_IO_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}jobs:
build:
uses: nais/actions/.github/workflows/mise-build-deploy-fasit.yaml@main
with:
builds-chart: true
chart-path: './charts'
deploys-to-fasit: true
secrets:
NAIS_IO_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}Label a pull request with deploy-dev-nais to deploy its chart to a Fasit dev environment. Set deploy-pr-targets to choose where it goes β the input doubles as the enable flag (empty = disabled). While the label is present the PR redeploys on every new push, not only when the label is first applied.
name: Build and Deploy
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, labeled]
permissions:
contents: read
id-token: write
jobs:
build:
uses: nais/actions/.github/workflows/mise-build-deploy-fasit.yaml@main
with:
builds-chart: true
deploy-pr-targets: |
[ { "target": { "kind": "management", "tenant": "dev-nais" } } ]
secrets:
NAIS_IO_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}Notes:
- The caller workflow must trigger on
pull_requestwith thelabeledtype, otherwise applying the label won't start a run. Deploys are gated on the PR's label list (github.event.pull_request.labels), sosynchronizeevents on an already-labeled PR redeploy too. builds-chart: trueis required β without a chart, there is nothing to deploy.- Target labels (e.g.
kind,tenant) depend on your feature; look up valid values in Fasit.
jobs:
build:
uses: nais/actions/.github/workflows/mise-build-deploy-fasit.yaml@main
with:
dockerfile-path: './build/Dockerfile'
docker-context: './build'
artifact-registry: 'europe-west1-docker.pkg.dev'
artifact-repo: 'my-project/my-repo'
secrets:
NAIS_IO_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}jobs:
build:
uses: nais/actions/.github/workflows/mise-build-deploy-fasit.yaml@main
with:
creates-git-tag: true
permissions:
contents: write
id-token: write
secrets:
NAIS_IO_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}| Input | Description | Required | Default |
|---|---|---|---|
mise-task-version |
mise task name for version generation | No | version |
mise-tasks |
JSON array of mise tasks to run in parallel for quality checks | No | ["tidy-check", "fmt-check", "lint", "vet", "check", "test-race"] (Go defaults - customize for your project) |
mise-task-build |
mise task name for building | No | build |
builds-docker |
Build and push Docker image | No | true |
dockerfile-path |
Path to Dockerfile | No | ./Dockerfile |
docker-context |
Docker build context | No | . |
builds-chart |
Build and push Helm chart | No | false |
chart-path |
Path to Helm chart directory | No | ./charts |
deploys-to-fasit |
Deploy to Fasit | No | false |
deploy-pr-targets |
PRs labeled "deploy-dev-nais" deploy to these targets | No | "" |
creates-git-tag |
Create and push git tag | No | false |
artifact-registry |
Docker registry for artifacts | No | europe-north1-docker.pkg.dev |
artifact-repo |
Docker repository name | No | nais-io/nais/images |
chart-repo |
Helm chart repository name | No | nais-io/nais/charts |
runner-size |
GitHub Actions runner size | No | ubuntu-latest |
runner-size-docker |
GitHub Actions runner size for Docker builds | No | ubuntu-latest |
helm-version |
Helm version to use | No | v3.16.3 |
| Secret | Description | Required |
|---|---|---|
NAIS_IO_WORKLOAD_IDENTITY_PROVIDER |
GCP Workload Identity Provider for authentication | No* |
* Required if pushing Docker images or Helm charts to Google Artifact Registry
| Output | Description |
|---|---|
version |
Generated version string from mise task |
name |
Repository name |
image |
Full Docker image reference with tag |
jobs:
build:
uses: nais/actions/.github/workflows/mise-build-deploy-fasit.yaml@main
secrets:
NAIS_IO_WORKLOAD_IDENTITY_PROVIDER: ${{ secrets.NAIS_IO_WORKLOAD_IDENTITY_PROVIDER }}
deploy-custom:
needs: build
runs-on: ubuntu-latest
steps:
- name: Deploy to custom environment
run: |
echo "Deploying ${{ needs.build.outputs.image }}"
echo "Version: ${{ needs.build.outputs.version }}"The calling workflow must have appropriate permissions:
permissions:
contents: read # Required for checkout (use 'write' if creates-git-tag: true)
id-token: write # Required for GCP authenticationNote: If using creates-git-tag: true, you must set contents: write instead of contents: read.
For Docker and Helm chart pushing, ensure you have:
- A GCP service account named
gh-{repository-name}@nais-io.iam.gserviceaccount.com - Workload Identity Federation configured
- The service account must have permissions to push to Artifact Registry
The reusable workflow consists of the following jobs:
- meta: Generates version and repository metadata
- lint: Runs quality checks in parallel (configurable via
mise-tasks) - build: Builds the Go application
- docker: Builds and pushes Docker image (if
builds-docker: true) - chart: Packages and pushes Helm chart (if
builds-chart: true) - rollout: Deploys to Fasit (if
deploys-to-fasit: true) - tag: Creates git tag (if
creates-git-tag: true)
-
Pin to a specific commit SHA: For maximum security and reproducibility, pin to a specific commit SHA. We recommend using Ratchet to automatically update SHA pins:
uses: nais/actions/.github/workflows/mise-build-deploy-fasit.yaml@abc123def456 # ratchet:nais/actions/.github/workflows/mise-build-deploy-fasit.yaml@main
Ratchet will automatically update the SHA while keeping the comment as a human-readable reference.
-
Use minimal permissions: Only grant the permissions your workflow needs:
permissions: contents: read # or 'write' if creates-git-tag: true id-token: write
-
Customize mise tasks: Adapt the quality checks to your project's needs:
with: mise-tasks: '["tidy-check", "fmt-check", "lint", "test"]'
-
Skip Docker builds for PRs: The workflow automatically skips pushing to production on pull requests
-
Use Ratchet or Dependabot: Keep your workflow reference updated:
- Ratchet: Automatically updates SHA pins in your workflow files
- Dependabot: Sends PRs for GitHub Actions updates (works with SHA pins)
If you see authentication errors:
- Verify the
NAIS_IO_WORKLOAD_IDENTITY_PROVIDERsecret is set - Confirm the GCP service account exists and has the correct name
- Check that Workload Identity Federation is configured
If a mise task is missing:
- Ensure all referenced tasks are defined in your
mise.toml - Check task names match exactly (case-sensitive)
- Run
mise taskslocally to list available tasks
If Docker builds fail:
- Verify
dockerfile-pathpoints to a valid Dockerfile - Check that
docker-contextcontains all necessary files - Review Docker build logs in the Actions run
Contributions are welcome! Please:
- Open an issue to discuss major changes
- Follow existing patterns and conventions
- Update documentation as needed
- Test changes thoroughly
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
- π Report a bug
- π‘ Request a feature
- π¬ Ask in discussions