-
Notifications
You must be signed in to change notification settings - Fork 3
165 lines (141 loc) · 4.65 KB
/
release.yml
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
name: Release
on:
pull_request:
types: [opened, synchronize, reopened, closed, ready_for_review]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
validate:
name: validate
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['18']
timeout-minutes: 20
steps:
- name: ⬇ Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: ⎔ Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: ⎔ Setup Node.js ${{ matrix.node-version }} for Github Packages
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com/'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: 📥 Install dependencies
run: pnpm install --frozen-lockfile
- name: 🏗 Build
run: pnpm clean && pnpm build
- name: 🔍 Verify types
run: pnpm type-check
- name: 💅 Verify format
run: pnpm format --check --no-write
- name: 🕵️ Lint
run: pnpm lint:prod
- name: 🛡️ Test
run: pnpm test
- name: 📏 Report bundle size
if: github.event.pull_request.merged == false
uses: andresz1/size-limit-action@v1
continue-on-error: true
with:
github_token: ${{ secrets.GPR_TOKEN }}
release-npm:
name: release-npm
needs: validate
runs-on: ubuntu-latest
if:
github.event_name == 'pull_request' && github.event.pull_request.merged == true &&
github.event.pull_request.base.ref == 'main'
strategy:
matrix:
node-version: ['18']
timeout-minutes: 20
steps:
- name: ⬇ Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: ⎔ Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: ⎔ Setup Node.js ${{ matrix.node-version }} for NPM
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
NPM_TOKEN: ${{ secrets.NPMJS_TOKEN }}
- name: ⎔ Setup .npmrc (NPM)
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPMJS_TOKEN }}" >> ~/.npmrc
- name: 📥 Install dependencies
run: pnpm install --frozen-lockfile
- name: 🚀 Create Release Pull Request or Release to NPM
uses: changesets/action@v1
id: changesetsId
with:
commit: 'chore: 🤖 update versions'
title: 'chore: 🤖 update versions'
publish: pnpm release:publish
version: pnpm release:version
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPMJS_TOKEN }}
release-gpr:
name: release-gpr
needs: [validate, release-npm]
if: >
github.event_name == 'pull_request' && github.event.pull_request.merged == true &&
github.event.pull_request.base.ref == 'main' && github.event.pull_request.head.ref == 'changeset-release/main'
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['18']
timeout-minutes: 20
steps:
- name: ⬇ Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: ⎔ Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Remove existing .npmrc for NPM
run: rm -f "$HOME/.npmrc"
- name: ⎔ Setup Node.js ${{ matrix.node-version }} for Github Packages
uses: actions/setup-node@v3
with:
cache: 'pnpm'
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com/'
- name: 📥 Install dependencies for Github Packages
run: pnpm install
env:
NODE_AUTH_TOKEN: ${{ secrets.GPR_TOKEN }}
- name: 🚀 Release to Github Packages
uses: changesets/action@v1
with:
commit: 'chore: update versions'
title: 'chore: update versions'
publish: pnpm release:publish
version: pnpm release:version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}