-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (47 loc) · 1.67 KB
/
release.yml
File metadata and controls
58 lines (47 loc) · 1.67 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
name: Release Monorepo Packages
on:
push:
tags:
- '@chimp-stack/*@*' # Triggers only on scoped version tags
permissions:
contents: write
jobs:
release:
name: Build and Publish ${{ matrix.package }}
runs-on: ubuntu-latest
strategy:
matrix:
package:
- core
- git-chimp
- doc-chimp
- release-chimp
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for tag detection
- uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org/'
- name: Install dependencies
run: npm ci
- name: Build package and dependencies with Turbo
run: npx turbo run build --filter=${{ matrix.package }} --concurrency=1
- name: Publish package if new
run: |
PACKAGE_NAME=$(node -p "require('./packages/${{ matrix.package }}/package.json').name")
CURRENT_VERSION=$(node -p "require('./packages/${{ matrix.package }}/package.json').version")
PUBLISHED_VERSION=$(npm view $PACKAGE_NAME version || echo "0.0.0")
echo "📦 Package: $PACKAGE_NAME"
echo "🔖 Current Version: $CURRENT_VERSION"
echo "📬 Published Version: $PUBLISHED_VERSION"
if [ "$CURRENT_VERSION" = "$PUBLISHED_VERSION" ]; then
echo "⏩ Skipping — already published."
exit 0
fi
echo "🚀 Publishing $PACKAGE_NAME@$CURRENT_VERSION..."
npm publish --workspace $PACKAGE_NAME --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}