-
-
Notifications
You must be signed in to change notification settings - Fork 39
149 lines (122 loc) · 3.72 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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: read
jobs:
build-release:
runs-on: ubuntu-latest
if: github.repository == 'tinylibs/tinybench'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: pnpm install --ignore-scripts --frozen-lockfile
- name: Build
run: pnpm build
- name: Type check
run: pnpm typecheck
- name: Lint
run: pnpm lint
- name: Run unit tests
run: pnpm test
env:
FORCE_COLOR: 2
- name: Run examples
run: cd examples && pnpm all
publish-npm:
runs-on: ubuntu-latest
needs: build-release
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
cache: pnpm
- name: Install dependencies
run: pnpm install --ignore-scripts --frozen-lockfile
- name: Read package.json version
id: package-version
uses: jaywcjlove/github-action-package@main
- name: Publish release
run: pnpm publish --no-git-checks
if: ${{ contains(steps.package-version.outputs.version, '-') == false }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish release candidate
if: ${{ contains(steps.package-version.outputs.version, '-rc') == true }}
run: pnpm publish --no-git-checks --tag next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish beta release
if: ${{ contains(steps.package-version.outputs.version, '-beta') == true }}
run: pnpm publish --no-git-checks --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish alpha release
if: ${{ contains(steps.package-version.outputs.version, '-alpha') == true }}
run: pnpm publish --no-git-checks --tag alpha
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
changelog:
runs-on: ubuntu-latest
needs: publish-npm
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- run: npx changelogithub
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-documentation:
runs-on: ubuntu-latest
needs: changelog
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
- name: Generate documentation
run: |
pnpm install --ignore-scripts --frozen-lockfile
pnpm typedoc
- name: Commit and push changes
if: github.ref == 'refs/heads/${{ github.event.repository.default_branch }}'
env:
COMMIT_MESSAGE: 'docs: publish documentation'
COMMIT_AUTHOR: Documentation Bot
COMMIT_EMAIL: [email protected]
run: |
git config --local user.name "${{ env.COMMIT_AUTHOR }}"
git config --local user.email "${{ env.COMMIT_EMAIL }}"
git pull
git add ./docs
git commit -a -m "${{ env.COMMIT_MESSAGE }}"
git push