Skip to content

Commit c07b889

Browse files
authored
Merge pull request #15 from readwiseio/rasul/document-release-publishing
[CI] Document Release Publishing Flow
2 parents 9ec1ea4 + 148fb70 commit c07b889

2 files changed

Lines changed: 25 additions & 13 deletions

File tree

‎.github/workflows/publish-npm.yml‎

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,13 @@ name: Publish npm package
33
on:
44
release:
55
types: [published]
6-
workflow_dispatch:
7-
inputs:
8-
tag:
9-
description: "Release tag to publish, e.g. v0.5.7"
10-
required: true
11-
type: string
126

137
permissions:
148
contents: read
159
id-token: write
1610

1711
concurrency:
18-
group: npm-publish-${{ github.event.release.tag_name || inputs.tag }}
12+
group: npm-publish-${{ github.event.release.tag_name }}
1913
cancel-in-progress: false
2014

2115
jobs:
@@ -26,15 +20,15 @@ jobs:
2620

2721
steps:
2822
- name: Reject prereleases
29-
if: github.event_name == 'release' && github.event.release.prerelease
23+
if: github.event.release.prerelease
3024
run: |
3125
echo "::error::This workflow only publishes stable releases to npm's latest dist-tag."
3226
exit 1
3327
34-
- name: Checkout publish tag
28+
- name: Checkout release tag
3529
uses: actions/checkout@v6
3630
with:
37-
ref: ${{ github.event.release.tag_name || inputs.tag }}
31+
ref: ${{ github.event.release.tag_name }}
3832
fetch-depth: 0
3933

4034
- name: Set up Node.js
@@ -53,7 +47,7 @@ jobs:
5347
- name: Validate release version
5448
id: version
5549
env:
56-
RELEASE_TAG: ${{ github.event.release.tag_name || inputs.tag }}
50+
RELEASE_TAG: ${{ github.event.release.tag_name }}
5751
run: |
5852
set -euo pipefail
5953
@@ -83,8 +77,8 @@ jobs:
8377
exit 1
8478
fi
8579
86-
git fetch origin master --depth=1
87-
if ! git merge-base --is-ancestor HEAD FETCH_HEAD; then
80+
git fetch origin +refs/heads/master:refs/remotes/origin/master
81+
if ! git merge-base --is-ancestor HEAD origin/master; then
8882
echo "::error::Release tag ${RELEASE_TAG} must point to a commit on origin/master."
8983
exit 1
9084
fi

‎README.md‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,21 @@ npm run build
183183
# Run without building
184184
npx tsx src/index.ts --help
185185
```
186+
187+
## Releasing
188+
189+
Merging a feature PR does not publish it to users. Users receive CLI changes only after a new npm version is published by the `Publish npm package` GitHub Action.
190+
191+
To ship a release:
192+
193+
1. Bump `package.json` and `package-lock.json` to the next version in a release PR.
194+
2. Merge the release PR to `master`.
195+
3. Create and publish a GitHub Release whose tag exactly matches the package version with a leading `v`, for example `v0.5.8`.
196+
4. Wait for the `Publish npm package` action to complete. It builds the CLI, checks that the release tag matches `package.json`, verifies the lockfile versions, and publishes to npm through trusted publishing.
197+
5. Confirm npm shows the new version:
198+
199+
```bash
200+
npm view @readwise/cli version
201+
```
202+
203+
If a version is prepared but never published, skip it and bump to the next version. npm versions do not need to be contiguous.

0 commit comments

Comments
 (0)