This guide explains the release process for the UNDRR Mangrove component library.
Releases use manual versioning with automated npm publishing. You choose the version number, update package.json, tag the release, and CI handles the rest.
We follow Conventional Commits for consistent, readable commit history, but we don't use semantic-release for automated version bumps. As a rapidly evolving component library, strict semver automation would produce excessive major version bumps — individual component breaking changes happen frequently during active development, but don't warrant a major library release when the change is scoped to a single component. Manual versioning gives us control over when to signal a significant release to consumers.
# Make sure everything passes
yarn test
yarn lintReview any components whose markup changed since the last release and update their HTML examples in scripts/ai-manifest/component-data.js. If utility classes were added or removed, update scripts/ai-manifest/css-utilities.js. These curated files feed the AI component manifest and can drift from reality between releases.
You can check for drift by running a full build and then validating the manifest:
yarn build
yarn validate-manifestThe validation checks for stale curated data keys, accessibility anti-patterns in HTML examples, and PropTypes coverage.
Edit version in package.json to the new version number:
{
"version": "1.3.0"
}Version guidance:
- Patch (1.2.14 → 1.2.15): bug fixes, dependency updates, minor style tweaks
- Minor (1.2.14 → 1.3.0): new components, new features, non-breaking enhancements
- Major (1.2.14 → 2.0.0): broad breaking changes across multiple components, API redesigns, major dependency upgrades (e.g., React major version)
yarn update-cdn-version # updates docs to reference new version
yarn update-cdn-version --dry-run # preview changes firstThis updates CDN URLs in README.md, MDX docs, and story files from the old version to the new one.
git add .
git commit -m "chore(release): v1.3.0"
git tag v1.3.0
git push origin main --tagsThe tag push triggers the NPM Publish workflow, which automatically:
- Builds the project
- Packages distribution files and SCSS sources
- Publishes to the npm registry
Go to GitHub Releases and create a release from the tag. Include a summary of changes — you can use the "Generate release notes" button for a starting point.
- npm package page shows the new version
- GitHub Releases has the release notes
If component JS or CSS changed:
yarn buildCopy built JS from dist/components/ to undrr_common/js/mangrove-components/ in the Drupal theme. If CSS changed, manually copy compiled CSS to each child theme's css/mangrove/mangrove.css.
If automated publishing fails, you can trigger it manually:
- Go to Actions → Publish to NPM Registry
- Click "Run workflow"
- Optionally enter a specific git tag (leave empty for latest)
Mangrove tracks changes at two levels:
- Component changelogs (in each component's MDX file): Track per-component version history. Update these whenever a PR modifies a component's behavior, API, or appearance. See the component standards for the required format (source:
stories/Documentation/ComponentContribution.mdx→ "Changelog format"). - Project releases (GitHub Releases): Track library-wide releases. Created during the release process above.
Component changelogs and project releases serve different audiences — component changelogs help developers working with a specific component, while project releases help consumers of the npm package understand what changed between versions.
We use Conventional Commits for readable history and PR title validation, even though version bumps are manual:
| Prefix | Purpose |
|---|---|
feat: |
New feature or component |
fix: |
Bug fix |
docs: |
Documentation only |
chore: |
Maintenance, dependencies |
refactor: |
Code restructuring |
test: |
Test additions or changes |
build: |
Build system or tooling |
ci: |
CI/CD configuration |
PR titles are validated by CI — see .github/workflows/pr-title-check.yml.
Published npm packages include:
/components/**/*— compiled React components (ES modules)/css/**/*— compiled CSS files/js/**/*— compiled vanilla JavaScript files/scss/**/*— source SCSS files/error-pages/**/*— static error page templates/fonts/**/*— Mangrove icon font
The project maintains a dist branch for CDN/static hosting via the UNDRR static assets repo. This branch is automatically updated on every push to main (not just releases).
- Content: compiled assets only (no source, no git history)
- Use case: static sites with no build process
Example CDN URLs:
# Latest (from dist branch, updated on every push to main)
https://assets.undrr.org/testing/static/mangrove/latest/css/style.css
https://assets.undrr.org/testing/static/mangrove/latest/components/MegaMenu.js
# Versioned (from tagged releases)
https://assets.undrr.org/static/mangrove/1.3.3/css/style.css
https://assets.undrr.org/static/mangrove/1.3.3/components/MegaMenu.js
https://assets.undrr.org/static/mangrove/1.3.3/js/tabs.js
| File | Purpose |
|---|---|
.github/workflows/npm-publish.yml |
npm publish on tag push (v*) |
.github/workflows/dist.yml |
Update dist branch on main push |
.github/workflows/storybook.yml |
Build and deploy Storybook to GitHub Pages |
.github/workflows/chromatic.yml |
Visual regression testing |
.github/workflows/pr-title-check.yml |
Validate PR titles follow Conventional Commits |
npm publishing uses OIDC trusted publishing instead of long-lived access tokens. GitHub Actions authenticates directly with npm using a short-lived OIDC token — no NPM_TOKEN secret is needed.
This is configured in two places:
- npmjs.com: package settings → Trusted Publisher links the
unisdr/undrr-mangroverepo andnpm-publish.ymlworkflow - Workflow:
id-token: writepermission and--provenanceflag onnpm publish
Published packages include a provenance attestation that cryptographically links the npm package to its source commit and build.
GITHUB_TOKEN— built-in, used by workflowsCHROMATIC_PROJECT_TOKEN— for visual regression testing (optional)
No npm token is required — trusted publishing handles authentication via OIDC.
| Symptom | Cause | Fix |
|---|---|---|
| npm publish fails with 403/404 | Trusted publisher not configured or misconfigured | Check package settings — repo, workflow filename, and environment must match |
| npm publish fails with OIDC error | Missing id-token: write permission in workflow |
Ensure the job has permissions: id-token: write |
| npm publish fails with Corepack error | Missing corepack enable step in workflow |
Check npm-publish.yml has the "Enable Corepack" step |
| CDN not updated | dist.yml workflow failed |
Check the workflow run; it runs on every push to main |
| PR title rejected | Doesn't follow Conventional Commits format | Use feat:, fix:, docs:, chore:, etc. prefix |
| Chromatic skipped | Commit or PR title contains [skip chromatic] |
Intentional; remove the flag to run visual tests |