Skip to content

Commit c567ed2

Browse files
authored
docs: add release guide (#401)
This PR adds release guide documentation.
1 parent 6004abf commit c567ed2

File tree

1 file changed

+111
-0
lines changed

1 file changed

+111
-0
lines changed

RELEASE_GUIDE.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Release Guide (stable-structures)
2+
3+
This guide describes how to cut releases and publish them to [crates.io](https://crates.io/crates/ic-stable-structures) for `ic-stable-structures`.
4+
5+
## Goals
6+
7+
- Ship improvements without breaking users
8+
- Validate APIs and memory model before stabilization
9+
- Keep rollback cheap
10+
11+
## Release Options
12+
13+
- **Opt-in feature flags**
14+
Hide experimental code behind non-default flags.
15+
16+
- **Semantic Versioning Pre-Releases** ([semver.org](https://semver.org))
17+
- `x.y.z-alpha.N` — experimental, incomplete, may be unstable or buggy
18+
- `x.y.z-beta.N` — feature complete, testing needed, bugs expected
19+
- `x.y.z-rc.N` — release candidate, no new features, only bug fixes
20+
21+
Cargo won’t auto-pick pre-releases; users must pin them explicitly.
22+
23+
## Policy
24+
25+
- Any breaking and/or major change requires a **design doc** reviewed by stakeholders before release.
26+
- Pre-releases (`-alpha`, `-beta`, `-rc`) are strongly encouraged for high-risk changes.
27+
28+
## When to Use (stable-structures specific)
29+
30+
- **Public API changes**
31+
- Added methods → behind a feature flag until validated
32+
- Removed/signature changes → breaking (minor bump <1.0.0, major bump ≥1.0.0)
33+
34+
- **Stable memory layout changes**
35+
- New/altered layout → feature flag + pre-release
36+
- Layout-breaking (cannot read old data) → breaking (minor bump <1.0.0, major bump ≥1.0.0)
37+
38+
- **Processing-only changes** (no layout change)
39+
- Compatible algorithmic updates → minor bump
40+
- High risk → feature flag and/or pre-release
41+
- Examples
42+
- Changing default values, coercions, or type conversions
43+
- Altering validation rules
44+
- Updating how parsing, ordering, deduplication, or filtering logic is applied
45+
- Modifying error handling or recovery behavior when reading/writing to stable memory
46+
47+
- **Hidden layout migrations** (auto-migrate on load)
48+
- If old data won’t load without migration → treat as breaking
49+
- Ship via feature flag + pre-releases; promote only after successful trials
50+
51+
## Example: Memory Reclaim
52+
53+
Adding a `reclaim()` method to free unused memory without changing layout, only processing it differently, is high risk and may cause data corruption:
54+
55+
- Hide `reclaim()` behind a feature flag
56+
- High risk → release as `-beta.N`
57+
- Iterate with feedback, promote to stable once validated
58+
- Remove feature flag after stabilization
59+
60+
## Release Process
61+
62+
### Prepare
63+
64+
1. Bump version in `Cargo.toml`:
65+
66+
```toml
67+
[package]
68+
version = "x.y.z"
69+
```
70+
71+
2. Ensure CI is green.
72+
3. Preferable commit & PR name: `chore(release): vX.Y.Z` ([example PR](https://github.com/dfinity/stable-structures/pull/379)).
73+
74+
### Publish Release to GitHub
75+
76+
1. Identify the commit to release.
77+
2. Draft a new release:
78+
- Go to the [Releases](https://github.com/dfinity/stable-structures/releases) tab.
79+
- Click **Draft a new release**.
80+
- Create a new tag `vX.Y.Z` pointing to the commit.
81+
- Set the release title to `vX.Y.Z`.
82+
- Choose the previous tag as the last release.
83+
- Add release notes (GitHub can auto-generate, adjust as needed).
84+
3. Click **Publish release**.
85+
86+
### Publish to crates.io
87+
88+
1. Generate an API token:
89+
- Log in to crates.io → **Account Settings****API Tokens** → generate a new token.
90+
2. Authenticate:
91+
```bash
92+
cargo login
93+
```
94+
Enter the token when prompted.
95+
3. Check out the repo at the release tag:
96+
```bash
97+
git checkout vX.Y.Z
98+
```
99+
4. Dry-run publish (mandatory):
100+
```bash
101+
cargo publish -p ic-stable-structures --dry-run
102+
```
103+
5. Publish:
104+
```bash
105+
cargo publish -p ic-stable-structures
106+
```
107+
108+
### Verify
109+
110+
- Check [crates.io](https://crates.io/crates/ic-stable-structures).
111+
- Confirm documentation builds on [docs.rs](https://docs.rs).

0 commit comments

Comments
 (0)