-
Notifications
You must be signed in to change notification settings - Fork 1.7k
74 lines (61 loc) · 1.78 KB
/
Copy pathrelease.yml
File metadata and controls
74 lines (61 loc) · 1.78 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
name: Release
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
id-token: write
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: "https://registry.npmjs.org"
# Ensure npm 11.5.1 or later is installed for Trusted Publishing.
- name: Update npm
run: npm install -g npm@latest
- name: Enable Corepack
run: |
npm install -g corepack@latest
corepack enable
- name: Get pnpm store directory
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-${{ runner.arch }}-pnpm-store-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-pnpm-store-
- name: Install dependencies
run: |
rm -rf node_modules
pnpm install --no-frozen-lockfile
- name: Build
run: pnpm run build
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: pnpm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Canary
if: github.ref == 'refs/heads/main'
run: |
git checkout main
pnpm run release-canary
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}