Sanity logosanity.ioAll Systems Operational© Sanity 2026
Change Site Theme
Sanity logo

Documentation

    • Overview
    • Platform introduction
    • Next.js quickstart
    • Nuxt.js quickstart
    • Astro quickstart
    • React Router quickstart
    • Studio quickstart
    • Build with AI
    • Content Lake
    • Functions
    • APIs and SDKs
    • Visual Editing
    • Blueprints
    • Platform management
    • Dashboard
    • Studio
    • Canvas
    • Media Library
    • App SDK
    • Content Agent
    • HTTP API
    • CLI
    • Libraries
    • Specifications
    • Changelog
    • User guides
    • Developer guides
    • Courses and certifications
    • Join the community
    • Templates
Blueprints
Overview

  • Introduction
  • Guides

    Deploy with GitHub Actions

  • Reference

    Configuration file
    CLI reference

On this page

Previous

Introduction

Next

Configuration file

Was this page helpful?

On this page

  • Prerequisites
  • Create a Blueprint
  • Create a Sanity API token
  • Add token to GitHub secrets
  • Create your workflows
  • Create a Deploy workflow
  • Create a Plan workflow
  • Custom working directory
  • Use deployment status in workflow
  • Configuration Reference
BlueprintsLast updated February 2, 2026

Deploy Blueprints with GitHub Actions

Use the official action to deploy your blueprints with GitHub Actions.

The official Blueprints GitHub Actions lets you add Blueprint planning and deployment to your existing GitHub workflows.

Prerequisites

Create a Blueprint

Before you get started, you should have a local blueprint configured and committed to the git repository you want to use. If you’re new to blueprints, you can get started by creating a function.

Before using these actions, you need configuration values from your project. Run the following command to retrieve your project and stack IDs.

npx sanity blueprints config
Current configuration:
  Sanity Project: <project_id>
  Deployment ID:  <stack_id>

Create a Sanity API token

Next you’ll need a Sanity API token with permission to deploy the blueprint.

  • Go to sanity.io/manage.
  • Select your project or organization.
  • Go to API → Tokens.
  • Select Add API token.
  • Create a token with deploy permissions.
  • Copy the token (you won't be able to see it again).

Add token to GitHub secrets

Next, add the API token to your GitHub secrets.

  • Go to your GitHub repository.
  • Navigate to Settings → Secrets and variables → Actions.
  • Select New repository secret.
  • Name: SANITY_TOKEN.
  • Value: Paste your Sanity API token.
  • Select Add secret.

Create your workflows

There are two actions available: deploy and plan.

The Deploy action executes sanity blueprints deploy in your GitHub workflow, automatically applying your Blueprint configuration to your Sanity project. It deploys your resources, like functions, and provides a deployment status output for use in your workflow.

Some ways you can use it are:

  • On pushes to your main/production branch for continuous deployment.
  • As part of a release workflow.
  • For scheduled deployments.
  • After manual workflow dispatch.

The Plan action runs sanity blueprints plan and automatically posts the results as a PR comment, giving your team visibility into what changes will be applied. It shows specific changes in the resources, as well as a summary of all changes.

Loading...

Some ways you can use it are:

  • Confirm what a blueprint will do before deploying.
  • Automatically post results as a collapsible PR comment.
  • Keep your PR discussions clean and organized.

Create a Deploy workflow

Create .github/workflows/deploy-blueprints.yml. Replace the stack and project ID placeholders with your values.

name: Deploy Sanity Blueprints

on:
  push:
    branches:
      - main

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

      - name: Deploy blueprints
        uses: sanity-io/blueprints-actions/deploy@deploy-v2
        with:
          sanity-token: ${{ secrets.SANITY_TOKEN }}
          stack-id: 'ST_1234xyz'
          project-id: '1234xyz'

Create a Plan workflow

Create .github/workflows/plan-blueprints.yml. Replace the stack and project ID placeholders with your values.

name: Sanity Blueprints Plan

on:
  pull_request:

permissions:
  contents: read
  pull-requests: write  # Required for posting comments

jobs:
  plan:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Plan blueprints changes
        uses: sanity-io/blueprints-actions/plan@plan-v1
        with:
          sanity-token: ${{ secrets.SANITY_TOKEN }}
          stack-id: 'ST_1234xyz'
          project-id: '1234xyz'

Custom working directory

If your blueprint isn’t at the root of your repository, add working-directory.

name: Sanity Blueprints Plan

on:
  pull_request:

permissions:
  contents: read
  pull-requests: write  # Required for posting comments

jobs:
  plan:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Plan blueprints changes
        uses: sanity-io/blueprints-actions/plan@plan-v1
        with:
          sanity-token: ${{ secrets.SANITY_TOKEN }}
          stack-id: 'ST_1234xyz'
          project-id: '1234xyz'
          working-directory: 'path/to/blueprints'

Use deployment status in workflow

The deploy action logs the deployment progress and provides a deployment-status output you can use in subsequent workflow steps. For example:

- name: Deploy blueprints
  id: deploy
  uses: sanity-io/blueprints-actions/deploy@deploy-v2
  with:
    sanity-token: ${{ secrets.SANITY_TOKEN }}
    stack-id: 'ST_1234xyz'
    project-id: '1234xyz'

- name: Notify on success
  if: steps.deploy.outputs.deployment-status == 'success'
  run: echo "Deployment successful!"

Configuration Reference

  • Requiredsanity-tokenstring

    A Sanity API token with deploy permissions.

  • Requiredstack-idstring

    The blueprint stack ID. Find this by running sanity blueprints config to view the active stack, or sanity blueprints stacks view all current stacks.

  • Requiredproject-idstring

    Sanity project ID. Find this by running sanity blueprints config or in your project settings at sanity.io/manage.

  • working-directorystring

    Path to the directory containing your blueprint config (sanity.blueprint.ts). Defaults to the repository root.

Visit the GitHub Actions Repository for additional details.

  • Article
  • Changelog
    New
npx sanity blueprints config
Current configuration:
  Sanity Project: <project_id>
  Deployment ID:  <stack_id>
A Sanity Blueprints deployment plan from a GitHub Actions bot, detailing a new function, removed test resources, and the deploy command.
name: Deploy Sanity Blueprints

on:
  push:
    branches:
      - main

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

      - name: Deploy blueprints
        uses: sanity-io/blueprints-actions/deploy@deploy-v2
        with:
          sanity-token: ${{ secrets.SANITY_TOKEN }}
          stack-id: 'ST_1234xyz'
          project-id: '1234xyz'
name: Sanity Blueprints Plan

on:
  pull_request:

permissions:
  contents: read
  pull-requests: write  # Required for posting comments

jobs:
  plan:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Plan blueprints changes
        uses: sanity-io/blueprints-actions/plan@plan-v1
        with:
          sanity-token: ${{ secrets.SANITY_TOKEN }}
          stack-id: 'ST_1234xyz'
          project-id: '1234xyz'
name: Sanity Blueprints Plan

on:
  pull_request:

permissions:
  contents: read
  pull-requests: write  # Required for posting comments

jobs:
  plan:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v4

      - name: Plan blueprints changes
        uses: sanity-io/blueprints-actions/plan@plan-v1
        with:
          sanity-token: ${{ secrets.SANITY_TOKEN }}
          stack-id: 'ST_1234xyz'
          project-id: '1234xyz'
          working-directory: 'path/to/blueprints'
- name: Deploy blueprints
  id: deploy
  uses: sanity-io/blueprints-actions/deploy@deploy-v2
  with:
    sanity-token: ${{ secrets.SANITY_TOKEN }}
    stack-id: 'ST_1234xyz'
    project-id: '1234xyz'

- name: Notify on success
  if: steps.deploy.outputs.deployment-status == 'success'
  run: echo "Deployment successful!"