-
Notifications
You must be signed in to change notification settings - Fork 2
63 lines (49 loc) · 1.5 KB
/
cd.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
name: CD
on:
pull_request:
types:
- closed
branches:
- main
jobs:
create-repository-release:
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref , 'release/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get Version
id: version
env:
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
run: echo "VERSION=${BRANCH_NAME:8}" >> $GITHUB_OUTPUT
- name: Create repository release
env:
GITHUB_TOKEN: ${{ secrets.GIT_TOKEN }}
run: gh release create ${{ steps.version.outputs.VERSION }} --generate-notes
publish-packages:
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref , 'release/')
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- uses: actions/checkout@v4
- name: Setup PNPM
uses: pnpm/action-setup@v3.0.0
with:
version: latest
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
cache-dependency-path: package.json
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Publish package
run: pnpm publish:package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}