-
Notifications
You must be signed in to change notification settings - Fork 9
61 lines (53 loc) · 1.81 KB
/
cli-prerelease.yml
File metadata and controls
61 lines (53 loc) · 1.81 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
name: ⏭️ CLI Pre-release
on:
push:
tags:
- 'v*.*.*-*' # pre-release e.g. v0.1.0-alpha.1
jobs:
cli-prerelease:
name: ⏭️ CLI Pre-release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 🟢 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
registry-url: 'https://registry.npmjs.org'
- name: 🔐 Setup npm auth
run: |
echo "registry=https://registry.npmjs.org" >> ~/.npmrc
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: 📦 Extract version from tag
id: version
run: |
# Extract version from git tag (remove 'v' prefix)
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Extracted version: $VERSION"
- name: 🔍 Verify version matches package.json
run: |
cd packages/xyd-js
PACKAGE_VERSION=$(node -p "require('./package.json').version")
echo "Package version: $PACKAGE_VERSION"
echo "Tag version: ${{ steps.version.outputs.VERSION }}"
if [ "$PACKAGE_VERSION" != "${{ steps.version.outputs.VERSION }}" ]; then
echo "❌ Version mismatch! Package.json has $PACKAGE_VERSION but tag is ${{ steps.version.outputs.VERSION }}"
exit 1
fi
echo "✅ Version match confirmed"
- name: 🚀 Publish to npm
run: |
cd packages/xyd-js
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}