Skip to Content
Grist Widgets

Releasing a widget

pnpm release: the version bump and changelog entry, as a pull request into dev, before the dev → main pull request.

A widget publishes when dev is merged into main: the deploy builds an immutable /v<version>/ and moves /latest/ to it. It publishes only a new version: merged without a version bump, the release build finds that version already live and does nothing. The pull request's CI says so first (below).

pnpm release makes that bump, with the changelog entry that goes with it, as a pull request into dev. It never pushes to dev itself:

git switch dev && git pull
pnpm release minor        # or patch, or major
# merge its pull request into dev, then open the dev → main pull request

What it does

At origin/dev, with nothing uncommitted, on dev or on a branch of your own made from it:

  1. Bumps package.json's version: patch for fixes, minor for features, major for a change that asks something of the people using the widget (a column to map again, an access level raised).
  2. Writes the CHANGELOG.md entry: one line per change dev has that main doesn't, from the merged pull requests' titles, whether they were squashed or merged with a merge commit (other merges and earlier release commits left out). It creates CHANGELOG.md if it is missing, and notes in the entry, as a comment, the commit the release was made from.
  3. Commits both as release: v<version>, on a new branch release/v<version>.
  4. Pushes the branch and opens its pull request into dev, with the GitHub CLI. Without gh, it prints the link that opens it.

Once that pull request is merged, open the dev → main pull request (the command prints its link). Merging it, once its checks are green, is the release.

Its options:

  • --branch <name> names the branch, for an agent kept to branches of its own;
  • --no-pr stops after the commit, before the push.

It refuses to run on main, with uncommitted changes, away from origin/dev, before the widget's first release (the first merge of dev into main sets the first version), or when dev has nothing main doesn't. If the push is refused, the commit stays on its branch and the message says why.

What CI checks on the pull request into main

A pull request into main is a release, so ci.yml runs two more jobs on it, besides lint, tests and build (check). The main ruleset requires release as well as check:

  • create-grist-widget release-check builds the widget as the release does and compares it with the published v<version>/:
    • nothing published yet, or a new version: the merge publishes it;
    • a new version with commits after the one that set it, or that reached dev after its release branch was made: it fails, since those commits would be released without their changelog line (commits main already has don't count). Run pnpm release again, so the changelog lists all of it;
    • the version already published and the same build (a docs change, say): it passes, and the merge releases nothing;
    • the version already published and another build: it fails. Raise the version on dev, or keep the change there until the next release. A Dependabot pull request opened on main, as its security updates are, fails it too: close it, and take its update through dev.
  • create-grist-widget check, in the grist job, opens the widget in a real Grist and compares it with its last release, pixel by pixel. The comparison is in the job's summary. The job isn't required, so a slow Docker pull never holds a release.

After the merge, the deploy's verify job runs verify-release: v<version>/ is served, and /latest/ is on the same build.

When to release

After the change has been checked in a real Grist document on /dev/. A widget that takes SDK updates releases after merging them into dev (Upgrading a widget): its users get the fixes the update carries.

On this page