Skip to content

Commit e3845d0

Browse files
committed
feat: add GitHub Actions workflow for publishing to npm
1 parent 2f2decd commit e3845d0

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

.github/workflows/publish.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Use Node.js 20
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 20
19+
registry-url: https://registry.npmjs.org
20+
21+
- name: Enable corepack (pnpm)
22+
run: corepack enable
23+
24+
- name: Install dependencies
25+
run: pnpm install --frozen-lockfile
26+
27+
- name: Verify tag matches package.json version
28+
run: |
29+
TAG="${GITHUB_REF_NAME}"
30+
PKG_VERSION="$(node -p "require('./package.json').version")"
31+
if [ "v${PKG_VERSION}" != "${TAG}" ]; then
32+
echo "::error::Tag ${TAG} does not match package.json version v${PKG_VERSION}"
33+
exit 1
34+
fi
35+
36+
- name: Publish
37+
env:
38+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
39+
run: pnpm publish --access public

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "content-structure",
33
"type": "module",
4-
"version": "2.1.0",
4+
"version": "2.2.0",
55
"description": "Stores parsed markdown in SQLite tables that can be used for rendering and database content management.",
66
"main": "index.js",
77
"bin": {

0 commit comments

Comments
 (0)