novinzodevelopers
Storefront & themes

Deploying a theme

Keep a store's theme in a GitHub repository and deploy it with GitHub Actions on every push, checked the way the storefront will render it.

A store's theme can live in the seller's own GitHub repository. Every push to the linked branch runs a GitHub Action that builds the theme, checks it and deploys it to the store.

The deploy proves which repository and branch it runs for with GitHub's OIDC token. No Novinzo secret is stored in the repository.

A store that has never deployed a theme renders the Novinzo theme its owner picked, the starter theme unless they picked another.

Set up a theme repository

Create the repository from the starter

Open emergente-labs/novinzo-theme-starter and choose Use this template → Create a new repository.

The starter is a complete theme with Liquid templates styled with Tailwind CSS. It already contains the deploy workflow.

In the dashboard, open Settings → Theme. In the GitHub repository card, enter the repository's Owner, its Repository name and the Branch to deploy from, then choose Link repository.

Only the store's owner can link, approve or unlink a repository. Other team members can view the page.

Add the store variable

In the repository, add the variable NOVINZO_STORE under Settings → Secrets and variables → Actions → Variables. Set it to the store's subdomain, as Settings → Theme shows it.

The value is not secret. The deploy authenticates with the OIDC token, not with this name.

Push, then approve the first run

Push to the linked branch. The first run deploys nothing: it fails with a message asking the owner to approve the repository.

Settings → Theme shows the run under A run is waiting for approval, with the GitHub user who started it, the repository and the commit. When the owner recognizes it, they choose Approve.

Re-run the job

Re-run the workflow job. From then on, every push to the linked branch deploys the theme.

Why the first run needs approval

A repository name alone does not prove who holds the repository. A typo or a name freed by a rename could let someone else's repository match the link.

Approval pins GitHub's numeric repository and owner IDs from the run that the owner approved. Runs from any other repository are refused afterwards, even one that later takes the same name. The repository then shows as Verified.

Changing the branch or the letter case of the same repository keeps the approval. Linking a different repository requires a new approval.

Only push and manually started (workflow_dispatch) runs can deploy. Other events that run on the branch, such as pull_request_target or workflow_run, are refused because they can run code from outside the repository.

The workflow

This is the starter's .github/workflows/deploy.yml. It deploys pushes to main; to deploy from another linked branch, change branches. A repository that was not made from the template needs this file too:

.github/workflows/deploy.yml
name: Deploy theme
on:
  push:
    branches: [main]
permissions:
  id-token: write
  contents: read
jobs:
  deploy:
    uses: emergente-labs/novinzo-theme-deploy/.github/workflows/deploy.yml@v1
    with:
      store: ${{ vars.NOVINZO_STORE }}

id-token: write lets the job request the OIDC token. Without it, the run fails before anything is uploaded.

The job calls the deploy workflow in the action's repository rather than listing its steps, so what it runs changes with the action's releases and you never edit it. A workflow can only be changed by a person, since GitHub does not let a workflow's token change workflow files. That workflow checks out the repository and runs the action, and a newer push cancels a deploy that is still running. The starter's check.yml and starter-updates.yml call that repository's check.yml and starter-updates.yml the same way.

The reusable workflows take the action's store, api-url, path and build inputs; a job can also run the action itself, emergente-labs/novinzo-theme-deploy@v1, after actions/checkout. The action takes these inputs:

InputDefaultPurpose
storeNoneThe store's subdomain. deploy and check need it.
api-urlhttps://dashboard.novinzo.com/apiThe Novinzo API to deploy to. Set it only for another Novinzo environment, such as staging.
path.Where the theme is in the repository.
buildtrueRun the theme's npm run build before sending it.
modedeploydeploy deploys the theme. check has Novinzo check it and deploys nothing. update takes in a newer starter release; see Taking in starter releases.

With mode: update, the action also sets two outputs:

OutputValue
versionThe starter release the theme now extends. Empty when there was no newer release, up to the one Novinzo serves.
summaryWhat the update changed, as a pull request description. Files with conflict markers to resolve are listed first.

A run goes through these steps:

  1. When the theme's package.json defines a build script, the action installs dependencies (npm ci with a lockfile, otherwise npm install) and runs npm run build. The starter builds its Tailwind CSS this way.
  2. It collects the deployable files.
  3. It requests an OIDC token from GitHub and sends the files to Novinzo, which checks them and deploys them to the store.
  4. It prints the outcome. Problems and warnings appear as annotations on the files and lines they concern.

Check a theme without deploying

With mode: check, the action builds the theme and has Novinzo check it the way a deploy does, without deploying it. The starter's check.yml workflow does this on every pull request, so problems show as annotations before a change is merged.

A check needs the same setup as a deploy: the NOVINZO_STORE variable, id-token: write, and a repository the store's owner has approved. Any branch of that repository may be checked. GitHub gives pull requests from forks no OIDC token, so the starter's workflow skips them. A store may have its theme checked 120 times an hour.

To check a theme on your computer, run npx @emergente-labs/theme-cli check in it. npm run check runs the same command in a theme made from starter 1.1.1 or later; an older theme gets the script when it takes in one of those releases. See Previewing a theme while you edit it.

What a deploy sends

A deploy sends only these files:

  • theme.json, which needs a name of 1 to 128 characters and can declare routes, settings and the starter release it extends.
  • *.liquid files in layouts/, sections/, snippets/ and templates/.
  • Files in assets/ with a web type: .css, .js, .mjs, .json, .map, .svg, .png, .jpg, .jpeg, .webp, .avif, .gif, .ico, .woff, .woff2, .ttf and .otf.

The action leaves other files, such as package.json and node_modules/, out of the upload. Paths must be plain relative paths: no .., no backslashes and no hidden files.

LimitValue
Files per theme500
Total size25 MiB (26,214,400 bytes)
Size of one file2 MiB (2,097,152 bytes)
RoutesAt most 50
Required templatesAll ten: 404, checkout-cancel, checkout, error, index, login, order-detail, orders, policy and product. The starter provides any a theme that extends it lacks.

A theme over the file count or total size is refused for that alone. Otherwise the check reports every problem at once:

  • A Liquid file that is not UTF-8 or does not compile. See Output escaping and render limits for what compilation refuses.
  • A missing page template, unless the theme extends the starter.
  • An extends Novinzo cannot serve: one that is not starter@<version>, or that names another major version than the starter Novinzo serves.
  • A component named as one of the starter's of another type, in a theme that extends it.
  • A route the storefront cannot serve: a path that breaks the path rules or starts with a reserved segment, a path declared twice, or a template that is missing or renders one of the storefront's own pages: the ten required templates, subscriptions and subscription-detail.
  • Two components with the same name in different directories. Component names must be unique across the theme.
  • A {% layout %}, {% section %} or {% render %} reference to a component that neither the theme nor the starter it extends contains.
  • An nz- element that the storefront does not serve. The nz- prefix is reserved for platform elements, so name your own custom elements without it.
  • A render-context field, storefront element or attribute that is past its removal date.

A successful deploy can also return warnings, shown as annotations. They cover deprecated features that still work and attributes that a storefront element does not read.

The deploy request

The action sends POST <api-url>/themes/deploy. You only need these details if you build your own deploy tooling inside GitHub Actions:

PartValue
AuthorizationBearer <GitHub Actions OIDC token>, issued for the audience novinzo-theme-deploy.
x-novinzo-storeThe store's subdomain.
Bodymultipart/form-data, with one file part per theme file, named by its path in the theme.

The platform verifies the token's signature against GitHub's published keys. It also checks the issuer https://token.actions.githubusercontent.com, the audience and the expiry.

It reads the repository name, the repository and owner IDs, the ref, the event, the actor and the commit SHA from the token. The request body is read only after the run is known to be allowed to deploy that store.

Every answer is JSON with a status of succeeded, failed or refused:

HTTP statusstatusMeaning
200succeededDeployed. Carries version, commitSha, unchanged and warnings.
400refusedThe x-novinzo-store header is missing, or the body is not one multipart part per file.
401refusedNo bearer token, or GitHub did not sign the token for theme deploys, or it has expired.
403refusedThe run may not deploy this store, or the owner has not approved the repository yet.
409refusedA deploy that started later went live first, so this one was discarded.
413refusedThe request is larger than a theme may be.
422failedThe theme has problems. Carries problems, each with file, an optional line and column, and message.
429refusedThe store reached its deploy limit. Retry-After gives the wait in seconds.
503refusedThe deploy failed on Novinzo's side. Run it again.

A run that may not deploy the store always gets the same 403 message. It does not reveal whether the store exists or which repository it deploys from.

mode: check sends the same request to POST <api-url>/themes/deploy/check, from a run of any branch of the linked repository. It publishes and records nothing. A theme that passes is answered 200 with status: "passed" and its warnings; a theme with problems gets the same 422 as a deploy. A repository the owner has not approved yet is refused with 403, since only a deploy from the linked branch asks the owner to approve it.

Versions, limits and rollback

Each successful deploy publishes the theme as the store's next version and makes it live at once. Novinzo keeps only the live version.

A store accepts at most 20 deploys per hour. Re-running a deploy of the commit that is already live returns unchanged: true without checking or publishing it again.

When two deploys overlap, the one that reserved the later version stays live. The earlier one is discarded and answered with 409.

A failed deploy leaves the storefront as it was. Settings → Theme lists recent deploys and their problems under Recent deploys.

To roll back, revert the commit and push. The owner can also choose Use a Novinzo theme on the Live theme card. The storefront then renders the Novinzo theme the store picked until the next successful deploy.

Unlinking the repository stops deploys. The storefront keeps rendering the theme that is live.

Taking in starter releases

A theme that extends the starter gets the files it does not have from the starter release Novinzo serves, with no work on its side. The copies of starter files it keeps stay as they are until it takes in a release.

Repositories made from starter 1.1.0 or later run .github/workflows/starter-updates.yml once a day. An older repository can add "extends" to its theme.json and copy that workflow from the starter repository. When Novinzo serves a newer starter release of the same major version, the workflow takes in the newest release tagged no later than that one (prerelease tags are skipped) and opens a pull request that:

  • replaces each copy the theme never changed with the release's, and deletes one the release no longer has;
  • merges the release's changes into each copy the theme changed, as git merges;
  • writes git's conflict markers into each copy where the theme and the release changed the same lines, and lists it first;
  • lists, and leaves as they are, a binary copy both changed, a copy the theme changed that the release no longer has, and a file the release adds that the theme already has one of;
  • takes in the release's package.json scripts, such as npm run check's command: each script the theme never changed becomes the release's, and each one it changed stays and is listed. Dependencies stay the theme's, as its lockfile records them;
  • moves extends to the release.

Resolve the conflict markers in the pull request before merging it: deploy and check refuse a theme whose files still have them, since Liquid would render them. The update changes no other file, nothing in package.json but scripts, and nothing in theme.json but extends. When Novinzo serves a new major version of the starter, the run fails and says what to do: a major version can change what templates rely on, so it is taken in by hand.

It opens nothing for a release that is tagged but that Novinzo does not serve yet, so the copies a theme keeps change together with the files it inherits. Merge the pull request to deploy it. Run the workflow from the Actions tab to look for a release at once.

GitHub lets the workflow open pull requests only once Settings → Actions → General → Allow GitHub Actions to create and approve pull requests is on in the repository. A pull request a workflow opens does not start other workflows, so close and reopen it to run the check. GitHub pauses scheduled workflows in a public repository after 60 days without activity; re-enable it from the Actions tab.

Deprecations

Themes depend on render-context fields, storefront elements, their attributes and their window events. Adding any of these is safe. Renaming or removing one breaks the themes that use it.

Novinzo therefore announces a removal first, with the last day the feature works. It stops working from the next day (UTC).

FeatureBefore the removal dateAfter the removal date
Render-context field, named by its path, with everything under itA deploy succeeds with a warning on each use, naming the replacement when there is one.A deploy that reads it fails with 422.
Storefront element, named by its tagThe same.A deploy that writes it fails with 422.
Element attribute, named as tag[attribute]The same.A deploy that sets it fails with 422.
Window event, named nz:<name>A deploy warns where Liquid or .js/.mjs assets name it in quotes.A deploy still only warns. Live themes are not flagged or replaced over events.

Novinzo also checks each store's live deployed theme about once a day:

  1. A use of an announced field, element or attribute is flagged on Settings → Theme with the files and lines that use it.
  2. The store owner receives one email about newly flagged uses.
  3. Once the removal date has passed, the store goes back to its Novinzo theme and the owner is emailed again. This happens at least 14 days after the first email, even when the notice went out close to the removal date.

The next successful deploy that no longer uses the removed feature brings the store's own theme back.

These checks cover the files a theme ships. Novinzo keeps the starter's files current, so a theme that extends the starter is never flagged for a file it inherits.

On this page