Basker Docs

Set up continuous delivery for a theme

Build, validate, and publish a custom theme from GitHub Actions to a Basker site.

Use GitHub Actions to release your custom theme to production from a protected branch. Run the first release manually. After you verify it, configure the workflow to run after each merge.

Release a theme with the Basker CLI

Identify the release target

Record your production workspace slug and its Basker admin and Partners API URLs. Sign in with basker auth login --basker-url <admin-url> --tenant <workspace-slug>. Run basker theme list from your theme folder. Record the live theme ID. This workflow updates an existing live theme. To set up a site for the first time, upload and publish the initial theme.

For the Partners API URL, use the base URL without /partners or an API version. Open /partners/openapi on that host and confirm it lists POST /{version}/{tenant}/themes/{id}/publish. If the route is missing, ask Basker Support when theme publishing is available for your site.

Configure the GitHub environment

Create a GitHub Actions environment named theme-production. Restrict deployments to your protected release branch. See Manage environments in GitHub Actions.

Ask Basker Support to provision a user API key if you do not already have one. Add the key as the BASKER_API_KEY environment secret. A site content key that starts with bsk_live_ cannot publish themes.

Add these environment variables.

VariableValue
BASKER_URLThe Basker admin base URL for the site.
BASKER_API_URLThe Partners API base URL for the same environment.
BASKER_TENANTThe workspace slug.
BASKER_THEME_IDThe ID of the site's existing live theme.

Add the workflow

Save this file as .github/workflows/release-theme.yml. The example expects the ready-to-upload theme files in theme/. Set THEME_DIR to your theme folder. Use . if the repository root is the theme folder.

If your theme uses a build tool, add your dependency install, build, and test steps before Validate theme. Use your repository's lockfile. Set THEME_DIR to the folder that contains the finished Liquid files and built assets. See Theme directory structure.

name: Release Basker theme

on:
  workflow_dispatch:

permissions:
  contents: read

concurrency:
  group: basker-theme-production
  cancel-in-progress: false

env:
  THEME_DIR: theme

jobs:
  release:
    runs-on: ubuntu-latest
    environment: theme-production
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false

      - uses: actions/setup-node@v4
        with:
          node-version: '24.22.1'

      - name: Install Basker CLI
        run: npm install --global @baskerhq/localstage@6.0.0

      - name: Validate theme
        run: basker theme check --theme "$THEME_DIR" --format github

      - name: Verify target and publish
        env:
          BASKER_URL: ${{ vars.BASKER_URL }}
          BASKER_API_URL: ${{ vars.BASKER_API_URL }}
          BASKER_TENANT: ${{ vars.BASKER_TENANT }}
          BASKER_THEME_ID: ${{ vars.BASKER_THEME_ID }}
          BASKER_API_KEY: ${{ secrets.BASKER_API_KEY }}
        shell: bash
        run: |
          : "${BASKER_URL:?Set BASKER_URL}"
          : "${BASKER_API_URL:?Set BASKER_API_URL}"
          : "${BASKER_TENANT:?Set BASKER_TENANT}"
          : "${BASKER_THEME_ID:?Set BASKER_THEME_ID}"
          : "${BASKER_API_KEY:?Set BASKER_API_KEY}"

          target=$(basker theme list --theme "$THEME_DIR" --json)
          if ! jq -e --arg workspace "$BASKER_TENANT" --arg id "$BASKER_THEME_ID" \
            '.workspace == $workspace and .liveThemeId == $id' <<< "$target" > /dev/null; then
            echo "::error::The configured theme is not live on the target workspace."
            exit 1
          fi

          basker theme push --theme "$THEME_DIR" --theme-id "$BASKER_THEME_ID" --publish --json

The job stops if validation fails or the configured theme is no longer live. When the upload and publish succeed, the last step reports the theme ID and revision. The run also identifies the source commit. Avoid other uploads or edits to the same theme during the release.

Verify the first release

Merge the workflow into your default branch. Run it manually from your protected release branch. Review the job output, then open the live site. Check a page that uses the changed theme and confirm that its CSS and JavaScript load.

Enable releases on merge

After you verify the first production release, add the push trigger below. Replace main if your protected release branch has another name.

on:
  workflow_dispatch:
  push:
    branches: [main]

Release one theme to several sites

Keep one source repository. Create a GitHub environment and release job for each site. Set each job's workspace, theme ID, and secret independently. Give each destination its own concurrency group. Check the result for every site because a release can succeed on one site and fail on another.

If you use tenant locking, create a separate output folder for each site. Before validation, set tenant in the theme_settings group of each folder's config/settings_schema.json to the target workspace slug. A lock accepts one slug. Keep the target values in the release configuration. See Theme settings and tenant locking.

Release through a connected GitHub branch

If you use the Basker GitHub App, configure your workflow to build and validate the theme, then commit the finished files to a dedicated branch. Connect that branch to the theme in Basker. After the first import, publish and activate the theme once. Successful pushes then update that live theme.

Use a separate output branch or directory for each tenant-locked bundle. For the connection steps, build output layout, and sync errors, see Sync a theme from GitHub.

Recover from a failed release

  • If validation fails, fix the source and run the workflow again.
  • If Basker rejects the API key, confirm that the job uses the right GitHub environment. Ask Basker Support to check the key and its access to the target workspace.
  • If the target check fails, confirm which theme should be live before changing BASKER_THEME_ID. If the theme is GitHub-connected, release through its connected branch.
  • If the upload succeeds and publishing fails, review the publish error. Fix it and rerun the workflow from the intended source commit. The uploaded revision remains a draft.
  • If a live release renders incorrectly, revert the release change in Git and publish through the same workflow. Verify the affected page on each site. For a GitHub-connected theme, rebuild and push the reverted output to its connected branch.

On this page