Skip to content

Commit a5cbaed

Browse files
committed
docs: document release bump levels and the prerelease identifier
The release process was undocumented outside of a one-line usage comment, and the prerelease identifier is the part a maintainer has to get right: it selects the npm dist-tag consumers install from, and lerna silently defaults it to "alpha". Adds a CONTRIBUTING.md with the release and prerelease commands, following the structure used in the runner and pytest-codspeed repos, and expands the usage header of release.sh with the bump levels and worked examples.
1 parent 018c7bb commit a5cbaed

2 files changed

Lines changed: 73 additions & 4 deletions

File tree

‎CONTRIBUTING.md‎

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Contributing
2+
3+
## Releasing a New Version
4+
5+
To create a new version, run:
6+
7+
```bash
8+
./scripts/release.sh patch # Increment PATCH component (e.g., 1.2.3 -> 1.2.4)
9+
./scripts/release.sh minor # Increment MINOR component (e.g., 1.2.3 -> 1.3.0)
10+
./scripts/release.sh major # Increment MAJOR component (e.g., 1.2.3 -> 2.0.0)
11+
```
12+
13+
All packages share a single version, bumped in lockstep by `lerna version`.
14+
15+
### Prereleases
16+
17+
A prerelease needs a bump level and a prerelease identifier (the label between
18+
the `-` and the counter in `5.8.0-beta.0`, also called the *preid*):
19+
20+
```bash
21+
./scripts/release.sh preminor beta # 5.7.1 -> 5.8.0-beta.0
22+
./scripts/release.sh prerelease beta # 5.8.0-beta.0 -> 5.8.0-beta.1
23+
```
24+
25+
`premajor`, `preminor` and `prepatch` start a new prerelease series;
26+
`prerelease` bumps the counter of the current one. The identifier defaults to
27+
`alpha` when omitted, since that is lerna's default.
28+
29+
The identifier becomes the npm dist-tag, so a prerelease is installed only by
30+
asking for it:
31+
32+
```bash
33+
pnpm add @codspeed/vitest-plugin@beta
34+
```
35+
36+
`latest` keeps pointing at the most recent stable release, and `^5` never
37+
resolves to a prerelease.
38+
39+
### What happens
40+
41+
1. **`scripts/release.sh`**:
42+
- Refuses to run outside `main` or with a dirty working tree
43+
- Runs `lerna version`, which bumps every package, commits, creates a signed
44+
`vX.Y.Z` tag and pushes it
45+
46+
2. **CI release workflow** (`.github/workflows/release.yml`):
47+
- Triggered automatically when the tag is pushed
48+
- Builds the native addon prebuilds for linux-arm and darwin-arm
49+
- Builds the libraries
50+
- Publishes to npm via OIDC trusted publishing, under the dist-tag derived
51+
from the tag's prerelease identifier (`latest` for a plain `vX.Y.Z` tag)
52+
- Creates a draft GitHub release, flagged as a prerelease when the version
53+
has a prerelease identifier

‎scripts/release.sh‎

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
#!/bin/bash
2-
# Usage: ./scripts/release.sh <major|minor|patch|premajor|preminor|prepatch|prerelease> [preid]
2+
#
3+
# Usage: ./scripts/release.sh <bump> [preid]
4+
#
5+
# bump major | minor | patch stable release
6+
# premajor | preminor | prepatch first prerelease of the next version
7+
# prerelease next prerelease of the current version
8+
#
9+
# preid Prerelease identifier: the label between the "-" and the counter in a
10+
# version, e.g. "beta" in 5.8.0-beta.0. Only meaningful for the pre*
11+
# bumps, where it defaults to "alpha". The release workflow publishes
12+
# under an npm dist-tag of the same name, so consumers opt in with
13+
# `npm install @codspeed/core@beta` while `latest` keeps pointing at
14+
# the last stable release.
15+
#
16+
# ./scripts/release.sh patch 5.7.1 -> 5.7.2 (dist-tag latest)
17+
# ./scripts/release.sh preminor beta 5.7.1 -> 5.8.0-beta.0 (dist-tag beta)
18+
# ./scripts/release.sh prerelease beta 5.8.0-beta.0 -> 5.8.0-beta.1 (dist-tag beta)
319
set -ex
420

521
# Fail if not on main
@@ -13,9 +29,9 @@ if [ $# -lt 1 ] || [ $# -gt 2 ]; then
1329
exit 1
1430
fi
1531

16-
# lerna defaults the prerelease identifier to "alpha"; the dist-tag the release
17-
# workflow publishes under is derived from it, so it must be spelled out for
18-
# any other channel.
32+
# The dist-tag the release workflow publishes under is derived from the
33+
# identifier, so any channel other than lerna's "alpha" default must be spelled
34+
# out here.
1935
PREID=()
2036
if [ $# -eq 2 ]; then
2137
if [[ ! "$2" =~ ^[a-z][a-z0-9-]*$ ]]; then

0 commit comments

Comments
 (0)