-
-
Notifications
You must be signed in to change notification settings - Fork 943
85 lines (68 loc) · 2.07 KB
/
Copy pathnpm-publish.yml
File metadata and controls
85 lines (68 loc) · 2.07 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
name: Publish Packages
on:
push:
tags:
- "v*"
permissions:
id-token: write
contents: read
env:
NX_CLOUD_DISTRIBUTED_EXECUTION: true
NX_CLOUD_ACCESS_TOKEN: '${{ secrets.NX_CLOUD_ACCESS_TOKEN }}'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
name: Checkout Source
with:
fetch-depth: 0
- uses: actions/setup-node@v6
name: Setup Node.js
with:
node-version: 24
registry-url: https://registry.npmjs.org
- uses: pnpm/action-setup@v4.2.0
name: Install pnpm
with:
run_install: false
- name: Initialize Nx Cloud
run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js"
- name: Get pnpm store directory
id: pnpm-cache
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v5
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: pnpm install
- name: Build All Packages
run: npx nx run-many -t build:ci
env:
CI: true
- name: Publish to NPM (OIDC Auth)
run: |
TAG="${GITHUB_REF#refs/tags/}"
BASE_CMD="npx lerna publish from-package --ignore-scripts"
echo "Publishing tag: $TAG via OIDC"
if [[ "$TAG" == *"-alpha."* ]]; then
$BASE_CMD --dist-tag alpha
elif [[ "$TAG" == *"-beta."* ]]; then
$BASE_CMD --dist-tag beta
elif [[ "$TAG" == v1* ]]; then
$BASE_CMD --dist-tag v1
elif [[ "$TAG" == v2* ]]; then
$BASE_CMD --dist-tag v2
elif [[ "$TAG" == v3* ]]; then
$BASE_CMD --dist-tag v3
else
$BASE_CMD
fi
- name: Stop Nx Cloud Session
run: npx nx fix-ci
if: always()