|
| 1 | +# Releasing |
| 2 | + |
| 3 | +This document describes how to release new versions of `@dsiu/rescript-graphology`. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- You must be logged in to npm: `npm whoami` |
| 8 | +- You must have publish access to the `@dsiu` scope on npm |
| 9 | + |
| 10 | +## One-Time Setup: Trusted Publishing |
| 11 | + |
| 12 | +This package uses [npm Trusted Publishing](https://docs.npmjs.com/generating-provenance-statements) with GitHub Actions OIDC. This eliminates the need for npm tokens stored as secrets. |
| 13 | + |
| 14 | +### Configure Trusted Publishing on npmjs.com |
| 15 | + |
| 16 | +1. Go to [npmjs.com](https://www.npmjs.com) and log in |
| 17 | +2. Navigate to your package: `@dsiu/rescript-graphology` |
| 18 | +3. Go to **Settings** > **Publishing access** |
| 19 | +4. Under **Trusted Publishing**, click **Add a trusted publisher** |
| 20 | +5. Configure: |
| 21 | + - **Repository owner**: `dsiu` |
| 22 | + - **Repository name**: `rescript-graphology` |
| 23 | + - **Workflow filename**: `publish.yml` |
| 24 | + - **Environment**: (leave blank) |
| 25 | +6. Click **Add** |
| 26 | + |
| 27 | +> **Note**: You must publish the package manually at least once before you can configure Trusted Publishing. |
| 28 | +
|
| 29 | +## Release Process |
| 30 | + |
| 31 | +### 1. Update Version |
| 32 | + |
| 33 | +```bash |
| 34 | +# Update version in package.json |
| 35 | +npm version patch # or minor, major |
| 36 | +``` |
| 37 | + |
| 38 | +This will: |
| 39 | +- Update `package.json` version |
| 40 | +- Create a git commit |
| 41 | +- Create a git tag |
| 42 | + |
| 43 | +### 2. Push Changes and Tag |
| 44 | + |
| 45 | +```bash |
| 46 | +git push origin main --tags |
| 47 | +``` |
| 48 | + |
| 49 | +### 3. Create GitHub Release |
| 50 | + |
| 51 | +```bash |
| 52 | +# Create a release (this triggers the publish workflow) |
| 53 | +gh release create v0.1.0 --title "v0.1.0" --notes "See CHANGELOG.md for details" |
| 54 | +``` |
| 55 | + |
| 56 | +Or create the release via GitHub UI: |
| 57 | +1. Go to **Releases** > **Create a new release** |
| 58 | +2. Choose the tag you just pushed |
| 59 | +3. Add release title and notes |
| 60 | +4. Click **Publish release** |
| 61 | + |
| 62 | +The `publish.yml` workflow will automatically: |
| 63 | +- Run tests |
| 64 | +- Publish to npm with provenance |
| 65 | + |
| 66 | +## First-Time Manual Publish |
| 67 | + |
| 68 | +For the very first publish (before Trusted Publishing is configured): |
| 69 | + |
| 70 | +```bash |
| 71 | +# Ensure you're logged in |
| 72 | +npm whoami |
| 73 | + |
| 74 | +# Build and test |
| 75 | +yarn clean && yarn build && yarn test |
| 76 | + |
| 77 | +# Publish (first time only) |
| 78 | +npm publish --access public |
| 79 | +``` |
| 80 | + |
| 81 | +After the first publish, configure Trusted Publishing as described above. |
| 82 | + |
| 83 | +## Manual Publishing (Fallback) |
| 84 | + |
| 85 | +If you need to publish manually (e.g., Trusted Publishing issues): |
| 86 | + |
| 87 | +```bash |
| 88 | +# Login to npm |
| 89 | +npm login |
| 90 | + |
| 91 | +# Build and test |
| 92 | +yarn clean && yarn build && yarn test |
| 93 | + |
| 94 | +# Publish |
| 95 | +npm publish --access public |
| 96 | +``` |
| 97 | + |
| 98 | +## Verifying the Release |
| 99 | + |
| 100 | +After publishing: |
| 101 | + |
| 102 | +1. Check npm: `npm view @dsiu/rescript-graphology` |
| 103 | +2. Verify provenance badge on npmjs.com package page |
| 104 | +3. Test installation in a new project: |
| 105 | + ```bash |
| 106 | + mkdir test-install && cd test-install |
| 107 | + npm init -y |
| 108 | + npm install @dsiu/rescript-graphology |
| 109 | + ``` |
| 110 | + |
| 111 | +## Version Guidelines |
| 112 | + |
| 113 | +- **Patch** (0.0.x): Bug fixes, documentation updates |
| 114 | +- **Minor** (0.x.0): New features, non-breaking changes |
| 115 | +- **Major** (x.0.0): Breaking changes |
| 116 | + |
| 117 | +For pre-1.0 releases, minor versions may include breaking changes. |
0 commit comments