This document outlines the step-by-step process for releasing a new version of the Schemata project.
Before starting a release, ensure:
- All changes are committed to the
masterbranch - The build process runs successfully:
pnpm build - Tests pass (if applicable):
pnpm test - You have the necessary permissions to:
- Push tags to the repository
- Create GitHub releases (requires
SCHEMATA_PATsecret) - Publish to NPM (requires
NPM_TOKENsecret) - Deploy to GitHub Pages
Update the version in package.json:
# Edit package.json and update the version field
# Follow semantic versioning: MAJOR.MINOR.PATCH
vim package.jsonIMPORTANT: You must commit and push the version change BEFORE creating the tag!
git add package.json
git commit -m "bump version to X.Y.Z"
git push origin masterAfter the version commit is pushed, create a tag with the version number prefixed with 'v':
# Replace X.Y.Z with your version number (must match package.json)
git tag vX.Y.Z
git push origin vX.Y.ZCritical:
- The tag version must match the version in package.json (e.g., if package.json has "version": "0.1.4", use tag
v0.1.4) - Always push the version commit to master BEFORE creating and pushing the tag
Once the tag is pushed, the following automated processes will trigger:
The .github/workflows/release.yml workflow will automatically:
-
Build the project
- Converts YAML schemas to JSON
- Removes
$idfrom source files (added at build time) - Generates the distribution files
-
Create Release Artifact
- Creates a zip file with all built schemas
- Names it
schemata-vX.Y.Z.zip
-
Create GitHub Release
- Creates a new release on GitHub
- Attaches the zip file as a release asset
- Only if the release doesn't already exist
-
Publish to NPM
- Publishes the package to NPM registry
- Only if the version isn't already published
The .github/workflows/deploy-pages.yml workflow will automatically:
-
Download Latest Release
- Fetches the zip file from the latest GitHub release
-
Flatten Directory Structure
- Reorganizes schemas for direct access:
/note/kind/{kind}.json- Event schemas by kind/tag/{tag_name}.json- Tag schemas/message/{MESSAGE_TYPE}.json- Protocol messages
- Reorganizes schemas for direct access:
-
Add $id Properties
- The
scripts/add-schema-ids.jsscript adds an$idto each schema - Each schema gets an
$idpointing to its GitHub Pages URL - Example:
https://nostrability.github.io/schemata/note/kind/1.json
- The
-
Deploy to GitHub Pages
- Publishes the flattened structure to GitHub Pages
- Available at: https://nostrability.github.io/schemata/
If any workflow fails or you need to re-run them:
- Go to Actions tab in GitHub
- Select "Release and Publish" workflow
- Click "Run workflow"
- Enter the version (e.g.,
v1.0.0)
- Go to Actions tab in GitHub
- Select "Deploy to GitHub Pages" workflow
- Click "Run workflow"
- Optionally enter a reason for manual deployment
After the release process completes:
-
Check GitHub Release
- Visit: https://github.com/nostrability/schemata/releases
- Verify the new release exists with the correct asset
-
Check NPM Package
- Visit: https://www.npmjs.com/package/@nostrwatch/schemata
- Verify the new version is published
-
Check GitHub Pages
-
Check Secrets
- Ensure
SCHEMATA_PATis configured in repository secrets - Ensure
NPM_TOKENis configured in repository secrets
- Ensure
-
Version Already Exists
- The workflow skips creating releases/publishing if they already exist
- This is normal behavior and not an error
-
Check GitHub Pages Settings
- Go to Settings → Pages
- Ensure "Source" is set to "GitHub Actions"
- Not "Deploy from a branch"
-
Check Permissions
- Go to Settings → Actions → General
- Ensure workflow has appropriate permissions
- The workflow needs: contents (read), pages (write), id-token (write)
If you need to build locally:
# Install dependencies
pnpm install
# Run the build
pnpm build
# The build process will:
# 1. Clean dist directory
# 2. Convert YAML to JSON (via Makefile)
# 3. Add $id properties at build time
# 4. Bundle schemas
# To test the full build including packages
pnpm build:all- Never manually add
$idto source YAML files - these are added automatically at build time - Always use semantic versioning for version numbers
- The
masterbranch is the main branch for releases - GitHub Pages URL structure matches the flattened deployment structure, not the source structure
After deployment, schemas are accessible at:
- Event Schemas:
https://nostrability.github.io/schemata/note/kind/{kind}.json - Tag Schemas:
https://nostrability.github.io/schemata/tag/{tag_name}.json - Protocol Messages:
https://nostrability.github.io/schemata/message/{MESSAGE_TYPE}.json
These URLs are automatically set as the $id property in each schema during the build process.