Merging a version bump into main releases it. The release workflow runs on every push to main. For a version which has no tag yet it:
- runs the tests,
- builds the MAPP and MAPP.UI bundles into
public/js/lib,public/css/mapp.cssandpublic/css/ui.css, - commits the bundles on top of
mainin aBuild <tag>commit, - tags that commit and pushes
mainand the tag together, - creates a GitHub release using
release-notes/<tag>.md, - merges
mainintopatchwithout the bundles and pushespatch.
The bundles are gitignored and are not tracked on the development branches (patch, minor, major), so they never cause merge conflicts there. Only main and the release tags track them, which makes a checkout of main, a release tag, or a source archive deployable without a build.
A squash merge from a development branch removes the bundles from main, because the development branch does not track them. The workflow rebuilds and commits the bundles on any push to main which does not contain them, also when the version is already tagged.
The workflow pushes to the protected main and patch branches with the PAT_TOKEN repository secret. The token owner must be allowed to push to main and to bypass the pull request rule on both branches.
The workflow does not deploy the app or publish an npm package. For deployment, see DEPLOYMENT.md. Once the release is created, the workflow calls the deploy-docs workflow with the tag, which publishes the knowledge portal; see DOCUMENTATION.md. The MAPP library is published to npm manually, see Publish the MAPP library to npm.
The example below releases v5.0.3. Replace that version everywhere with your target version.
Run commands from the repository root with a clean working tree (git status --short should show nothing). You need permission to push release tags to GEOLYTIX/xyz, plus the tools described in local development. Use the pnpm version in the root package.json.
These commands assume origin is GEOLYTIX/xyz, not your fork. Check with git remote -v first.
git switch main
git pull --ff-only origin main
git fetch origin --tags
git switch -c release/v5.0.3
pnpm installChoose one command:
| Release type | Use for | Command |
|---|---|---|
| Patch | Backwards-compatible bug fixes | pnpm bump:patch |
| Minor | Backwards-compatible features | pnpm bump:minor |
| Major | Breaking changes | pnpm bump:major |
The script increments the current version in package.json, README.md, apps/mapp/lib/mapp.mjs and apps/mapp/package.json. Check all four with git diff, and check they match with node utils/check-version.js. Do not run it again if the target version is already set. It does not create a commit or tag.
Create or update release-notes/v5.0.3.md. Summarise the changes, link relevant PRs, and explain any breaking changes or migration steps. Follow an existing example.
The filename must match the version exactly, including the v prefix, and the notes must be in the same pull request as the version bump. The workflow fails without them.
pnpm exec biome check .
pnpm test
pnpm build --filter=@geolytix/mapp --filter=@geolytix/mapp-ui
git status --shortStop and resolve any failures. The local build only checks that the bundles build. A branch from main tracks the bundles, so discard the rebuilt files before committing: git restore public/js/lib public/css/mapp.css public/css/ui.css. The workflow commits the release build.
git add package.json README.md apps/mapp/lib/mapp.mjs apps/mapp/package.json release-notes/v5.0.3.md
git diff --cached
git commit -m "Prepare release v5.0.3"
git push -u origin release/v5.0.3Open a pull request into main and wait for the required checks and review. Merging the pull request publishes the release. Do not create or push the tag yourself; the workflow skips a version which is already tagged, so a manual tag would release without bundles.
- Check Actions → Release succeeds.
- Check Releases shows the correct version and notes.
- Check Actions → Deploy the knowledge portal to Pages succeeds and the portal footer names the new version.
- Check
mainand the tag contain the bundles:git fetch origin --tags && git ls-tree -r --name-only v5.0.3 public/js/lib && git ls-tree -r --name-only origin/main public/js/lib. - Deploy separately if needed, following DEPLOYMENT.md.
The workflow merges main into patch after each release; check patch has a new Merge main into patch commit. The sync step fails when the merge conflicts in files other than the bundles, eg. when patch received changes during the release. Sync patch manually in that case.
Merging main either adds the bundles or stops with a modify/delete conflict on them; untracking them resolves both cases and keeps the built files in the working tree.
The release notes file is added on patch and amended in the release commit, so the merge conflicts on it (add/add). main's version is the final one. The workflow takes it, and so do the commands below.
git switch patch
git pull --ff-only origin patch
git fetch origin main
git merge --no-commit origin/main
git rm -r --cached --ignore-unmatch --quiet public/js/lib public/css/mapp.css public/css/ui.css
git checkout origin/main -- release-notes
git status --short
git commit -m "Merge main into patch"
git push origin patchgit status --short must not list any other conflicts or bundle files before the commit.
If the workflow fails before the tag is pushed, fix the cause in a new commit to main, or re-run the failed job for a transient failure. The next push to main retries the release while the version is still untagged. If the tag was pushed but the GitHub release is missing, re-run the job; it skips the build when main already contains the bundles and only creates the release. Never move or overwrite a published release tag.
The MAPP library is published to npm as @geolytix/mapp. Publishing is manual for now. The release workflow doesn't publish to npm.
The package version is the XYZ release version. The MAPP library doesn't change in every release, so after a release a maintainer decides whether to publish it. Check for MAPP changes since the last published version:
npm view @geolytix/mapp dist-tags
git diff --stat v5.1.0 v5.1.3 -- apps/mapp/lib apps/mapp/cssA published version can't be changed or reused, and npm limits unpublishing. Releases without MAPP changes are not published, so the npm versions can have gaps, eg. 5.1.0 and then 5.1.3.
The Publish MAPP workflow only runs on a manual dispatch from Actions → Publish MAPP, or with the GitHub CLI. It publishes the branch or tag it is dispatched from, the Use workflow from ref or the --ref of the CLI:
# A release, after the release workflow pushed the tag.
gh workflow run publish_mapp.yml --ref v5.1.0 -f dist_tag=latest
# A prerelease from a development branch, published as 5.1.0-rc.2.
gh workflow run publish_mapp.yml --ref minor -f dist_tag=next -f prerelease=rc.2| Input | Description |
|---|---|
dist_tag |
latest for a release, dispatched from the release tag, eg. v5.1.0. next for a prerelease of a branch or tag. |
prerelease |
The prerelease identifier for next, eg. rc.2. The version is the apps/mapp/package.json version with the identifier, eg. 5.1.0-rc.2. |
The workflow checks that the versions match and that the version isn't published yet. It runs the MAPP library tests, builds and packs the package, runs the package test with the tarball, and publishes the tarball with provenance. The prerelease version is only set in the workflow checkout and isn't committed.
The publish job runs in the npm environment, which requires the approval of a reviewer. npm authenticates the workflow with trusted publishing (OIDC), so there is no npm token.
The deployment rules of the npm environment apply to the dispatched ref, so only the permitted branches and tags can be published. The ref must contain the workflow file. GitHub only lists a manually dispatched workflow once the workflow file is on main. Until then, publish locally.
The workflow checks the published version after the publish:
- the dist-tag points to the version.
- the published
dist.integrityis the integrity of the tested tarball. - the version has a provenance attestation, and
npm audit signaturesverifies it. - the package test passes with the version installed from npmjs.com.
- jsDelivr serves the same
mapp.jsandmapp.css. The workflow then purges the jsDelivr cache of the dist-tag urls, eg.@next/dist/mapp.js, which jsDelivr caches for 12 hours.
These checks can't undo the publish. If one fails, check the version, and if it is broken:
- move the dist-tag back to the previous version, eg.
npm dist-tag add @geolytix/mapp@5.1.0-rc.1 next. - deprecate the version, eg.
npm deprecate @geolytix/mapp@5.1.0-rc.2 "Broken, use 5.1.0-rc.3". - publish a fixed version. A published version can't be reused.
Trusted publishing only covers npm publish, so an owner of the geolytix npm organisation runs these commands locally.
To check a published version locally:
- The npm page shows the version, the dist-tag and the provenance.
- The jsDelivr CDN serves the version, eg.
https://cdn.jsdelivr.net/npm/@geolytix/mapp@5.1.0/dist/mapp.js. - The cdn view of the testhost loads the version from jsDelivr:
pnpm testviewand open/views/cdn/?version=5.1.0. - The package test runs with the version from npmjs.com:
node scripts/installPackage.mjs --version=5.1.0andpnpm test:packagefromapps/mapp.
The first version must be published locally by an owner of the geolytix npm organisation, because npm trusted publishing can only be set up for a package which exists. A local publish has no provenance and requires npm two-factor authentication.
pnpm install
pnpm test:mapp
pnpm build --filter=@geolytix/mapp --force
cd apps/mapp
npm pkg set version=5.1.0-rc.1 # a prerelease only, don't commit the change
pnpm pack:check
pnpm pack:install
pnpm test:package
cd .pack
npm login
npm publish geolytix-mapp.tgz --access public --tag next
cd .. && git restore package.jsonAfter the first publish, an owner of the geolytix npm organisation sets up the package once:
- Create the
npmenvironment in the GitHub repository settings with required reviewers, and restrict it to themainbranch and thev*tags. Addminorandpatchto publish prereleases from them. - On npm, open the
@geolytix/mapppackage settings and add a trusted publisher: GitHub Actions, organisationGEOLYTIX, repositoryxyz, workflowpublish_mapp.yml, environmentnpm. - Set the publishing access of the package to require two-factor authentication and disallow tokens. The trusted publisher isn't affected.