-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (57 loc) · 2.01 KB
/
cd.yml
File metadata and controls
69 lines (57 loc) · 2.01 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
name: cd
on:
release:
types: [published]
permissions:
contents: read
id-token: write
jobs:
publish:
name: Publish plugin-sdk-react package
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: "1.2.23"
- name: Cache Bun packages
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-plugin-sdk-react-${{ hashFiles('bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-plugin-sdk-react-
- name: Install dependencies
run: bun install --frozen-lockfile
# Strip the leading 'v' from the release tag (v1.2.3 → 1.2.3) so it
# matches npm's semver format, then stamp package.json without a git tag.
# Must run BEFORE build so the version is baked into build/package.json.
- name: Set package version
run: |
VERSION="${{ github.event.release.tag_name }}"
npm version "${VERSION#v}" --no-git-tag-version
- name: Build
run: bun run build
- name: Setup Node.js with npm registry
uses: actions/setup-node@v4
with:
node-version: "20"
registry-url: "https://registry.npmjs.org"
scope: "@paca-ai"
- name: Upgrade npm
run: npm install -g npm@latest
# For prerelease versions (e.g. 1.0.0-alpha.1), npm requires an explicit
# --tag to avoid accidentally tagging as "latest".
- name: Publish to npm
run: |
VERSION="${{ github.event.release.tag_name }}"
CLEAN_VERSION="${VERSION#v}"
if [[ "$CLEAN_VERSION" == *"-"* ]]; then
PRERELEASE_LABEL=$(echo "$CLEAN_VERSION" | sed 's/[^-]*-\([a-zA-Z]*\).*/\1/')
npm publish --provenance --access public --tag "${PRERELEASE_LABEL:-next}"
else
npm publish --provenance --access public
fi