-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (65 loc) · 2.23 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
name: Release
env:
USE_LOCKFILE: ${{ secrets.USE_LOCKFILE }}
ENABLE_RELEASE: ${{ secrets.ENABLE_RELEASE }}
on:
push:
branches: [ master, alpha, beta ]
repository_dispatch:
types: [ release ]
jobs:
release:
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]') && ! contains(toJSON(github.event.commits.*.message), '(no-release)')"
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ["lts/*"]
steps:
# region Setup
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
name: Setting Up Node.js (${{ matrix.node-version }})
with:
node-version: ${{ matrix.node-version }}
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: latest
- name: Get Pnpm Cache Path
id: pnpm-cache
run: echo "dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- run: "echo Cache Key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}"
- run: "echo Cache Restore-Keys: ${{ runner.os }}-pnpm-store-"
- run: "echo Pnpm Cache Hit: ${{ steps.pnpm-cache.outputs.cache-hit }}"
- run: pnpm install --frozen-lockfile
if: "env.USE_LOCKFILE == 'true'"
- run: pnpm install --no-lockfile
if: "env.USE_LOCKFILE != 'true'"
# regionend
# region Steps
- run: pnpm build
- run: pnpm lint:eslint # test command will lint types
- run: pnpm test
- name: Release
if: "env.ENABLE_RELEASE == 'true'"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
- name: Release Dry Run
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release --dry-run
if: "env.ENABLE_RELEASE != 'true'"
- run: echo "env.ENABLE_RELEASE is ${{ env.ENABLE_RELEASE }}, no release can be published" && exit 1
if: "env.ENABLE_RELEASE != 'true'"
# regionend