Skip to content

Commit 50634bc

Browse files
Add npm-publish workflow for UI package
- Detect version bump in `packages/ui/package.json` - Build UI package and publish to npm with `beta` tag, then promote to `latest`
1 parent 5b305d7 commit 50634bc

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

.github/workflows/npm-publish.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Publish @synergycodes/axiom package to NPM
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
steps:
15+
- name: Checkout repo
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 2
19+
20+
- name: Setup Node.js (with pnpm via Corepack)
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '22'
24+
cache: 'pnpm'
25+
cache-dependency-path: '**/pnpm-lock.yaml'
26+
27+
- name: Install dependencies
28+
run: pnpm install --frozen-lockfile
29+
30+
- name: Read versions
31+
id: version-check
32+
run: |
33+
OLD=$(git show HEAD~1:packages/ui/package.json | jq -r .version)
34+
NEW=$(jq -r .version packages/ui/package.json)
35+
echo "old=$OLD" >> $GITHUB_OUTPUT
36+
echo "new=$NEW" >> $GITHUB_OUTPUT
37+
38+
- name: Build UI package
39+
if: steps.version-check.outputs.new != steps.version-check.outputs.old
40+
run: |
41+
pnpm ui build
42+
43+
- name: Publish Beta & Tag Latest
44+
if: steps.version-check.outputs.new != steps.version-check.outputs.old
45+
env:
46+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
47+
run: |
48+
cd packages/ui
49+
echo "Publishing @synergycodes/axiom@${{ steps.version-check.outputs.new }} with 'beta' tag…"
50+
pnpm publish --access public --tag beta
51+
echo "Adding 'latest' dist-tag to @synergycodes/axiom@${{ steps.version-check.outputs.new }}…"
52+
pnpm dist-tag add @synergycodes/axiom@${{ steps.version-check.outputs.new }} latest

0 commit comments

Comments
 (0)