-
Notifications
You must be signed in to change notification settings - Fork 26
43 lines (37 loc) · 1.02 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
name: release
on:
workflow_dispatch:
pull_request:
types: [closed]
branches:
- main
jobs:
publish:
if:
(github.event.pull_request.merged == true &&
github.event.pull_request.head.ref == 'prepare-release') ||
github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org/"
- uses: pnpm/action-setup@v4
- run: pnpm install
- name: Get version
id: get_version
run: |
echo "VERSION=$(jq -r '.version' packages/controller/package.json)" >> $GITHUB_OUTPUT
- name: Publish to npm
run: |
if [[ ${{ steps.get_version.outputs.VERSION }} == *-* ]]; then
pnpm prerelease
else
pnpm release
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}