-
Notifications
You must be signed in to change notification settings - Fork 3
97 lines (82 loc) · 2.86 KB
/
Copy pathnpm-publish.yml
File metadata and controls
97 lines (82 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Publish NPM Packages
on:
workflow_call:
inputs:
version:
description: "Semver version to publish (e.g. 0.2.0 or 0.0.0-nightly.20260224)"
required: true
type: string
dist-tag:
description: "npm dist-tag (latest, nightly, etc.)"
required: false
type: string
default: "latest"
secrets:
NPM_TOKEN:
required: true
jobs:
publish:
name: Publish @omniviewdev/* packages
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10
run_install: false
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Normalize version
id: version
shell: bash
run: |
version=$(echo "${{ inputs.version }}" | sed 's/^v//')
echo "version=${version}" >> "$GITHUB_OUTPUT"
- name: Stamp package versions
shell: bash
run: |
VERSION="${{ steps.version.outputs.version }}"
for pkg in \
packages/omniviewdev-providers/package.json \
packages/omniviewdev-runtime/package.json \
packages/omniviewdev-ui/package.json \
packages/omniviewdev-vite-plugin/package.json; do
jq --arg v "$VERSION" '.version = $v' "$pkg" > tmp.$$.json && mv tmp.$$.json "$pkg"
echo "Stamped $pkg → $VERSION"
done
# Build in dependency order: providers → vite-plugin → ui → runtime
- name: Build providers
run: pnpm --filter @omniviewdev/providers run build
- name: Build vite-plugin
run: pnpm --filter @omniviewdev/vite-plugin run build
- name: Build ui
run: pnpm --filter @omniviewdev/ui run build
- name: Build runtime
run: pnpm --filter @omniviewdev/runtime run build
- name: Publish packages
shell: bash
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.version }}"
TAG="${{ inputs.dist-tag }}"
for pkg in providers vite-plugin ui runtime; do
PKG_NAME="@omniviewdev/${pkg}"
# Check if this exact version already exists on the registry
if npm view "${PKG_NAME}@${VERSION}" version 2>/dev/null; then
echo "⏭ ${PKG_NAME}@${VERSION} already published — skipping"
continue
fi
echo "📦 Publishing ${PKG_NAME}@${VERSION} (tag: ${TAG})"
pnpm --filter "${PKG_NAME}" publish \
--access public \
--tag "${TAG}" \
--no-git-checks
done