-
Notifications
You must be signed in to change notification settings - Fork 29
136 lines (108 loc) · 3.37 KB
/
ci.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
name: CI
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
jobs:
install_and_test_win:
runs-on: windows-latest
timeout-minutes: 5
strategy:
matrix:
node-version: [20]
name: Windows - Node ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: pnpm/action-setup@v3
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: pnpm install --frozen-lockfile --prefer-offline
- name: Typecheck
run: pnpm typecheck
- name: Build
run: pnpm build
- name: Test
run: |
pnpm test
pnpm test:post
install_and_test:
runs-on: [ubuntu-latest]
timeout-minutes: 5
strategy:
matrix:
node-version: [16, 18, 20]
name: Linux - Node ${{ matrix.node-version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: pnpm/action-setup@v3
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
run: pnpm install --frozen-lockfile --prefer-offline
- name: Typecheck
run: pnpm typecheck
- name: Build
run: pnpm build
- name: Test
run: |
pnpm test
pnpm test:post
release:
runs-on: ubuntu-latest
needs: [install_and_test]
if: startsWith(github.ref, 'refs/tags/')
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v3
- name: Use Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: pnpm
- name: Write Auth
# https://github.com/pnpm/pnpm/blob/d491da0c08be420362444398ce149b586a74f3cc/.github/workflows/release.yml#L45C11-L45C103
run: npm config set "//registry.npmjs.org/:_authToken" "${NPM_TOKEN}" # pnpm config set is broken
- name: Install Dependencies
run: pnpm install --frozen-lockfile --prefer-offline
- name: Determine tag
id: determine_tag
run: |
echo "tag=$(echo $GITHUB_REF | grep -Eo 'alpha|beta|rc')" >> $GITHUB_OUTPUT
- name: Publish to versioned tag
if: steps.determine_tag.outputs.tag != ''
run: |
echo "Publishing to ${{ steps.determine_tag.outputs.tag }} tag"
pnpm publish --tag ${{ steps.determine_tag.outputs.tag }} --no-git-checks
- name: Publish to latest
if: steps.determine_tag.outputs.tag == ''
run: |
echo "Publishing to latest"
pnpm publish --no-git-checks