-
-
Notifications
You must be signed in to change notification settings - Fork 3
206 lines (197 loc) · 5.28 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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: Continuous Integration
on:
push:
branches: main
pull_request:
branches: main
defaults:
run:
shell: bash
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v2
- run: deno task lint
test-1:
name: Test (1st pass)
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v2
- run: deno task install:deno
- run: deno task test:deno
test-2:
name: Test (2nd pass)
runs-on: ${{ matrix.os }}
needs:
- lint
- test-1
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
# - windows-latest
- macos-latest
runtime:
- name: deno
version: 2.x
- name: node
version: 22.x
- name: bun
# https://github.com/oven-sh/setup-bun/issues/37
# version: 1.x
version: latest
exclude:
# https://github.com/oven-sh/bun/issues/5835
- os: windows-latest
runtime:
name: bun
version: latest
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v2
- if: matrix.runtime.name == 'deno'
uses: denoland/setup-deno@v2
with:
deno-version: ${{ matrix.runtime.version }}
- if: matrix.runtime.name == 'node'
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.runtime.version }}
- if: matrix.runtime.name == 'bun'
uses: oven-sh/setup-bun@v2
with:
bun-version: ${{ matrix.runtime.version }}
- run: deno task install:${{ matrix.runtime.name }}
- run: deno task test:${{ matrix.runtime.name }}
test:
name: Test
runs-on: ubuntu-latest
needs:
- test-1
- test-2
steps:
- run: sleep 0
codeql:
name: Code quality
runs-on: ubuntu-latest
needs:
- lint
- test-1
permissions:
security-events: write
steps:
- uses: actions/checkout@v4
- uses: github/codeql-action/init@v3
with:
languages: typescript
- uses: github/codeql-action/analyze@v3
preview:
name: Preview
runs-on: ubuntu-latest
needs:
- lint
- test-1
permissions:
id-token: write
contents: read
environment:
name: preview
url: ${{ steps.preview.outputs.url }}
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v2
- run: deno task ci:setup-deno-deploy
id: setup_github_actions
- run: deno task install:deno
- uses: denoland/deployctl@v1
id: preview
# https://github.com/denoland/deployctl/issues/350
with:
project: ${{ steps.setup_github_actions.outputs.project }}
entrypoint: ${{ steps.setup_github_actions.outputs.entrypoint }}
import-map: ${{ steps.setup_github_actions.outputs.import_map }}
include: ${{ steps.setup_github_actions.outputs.include }}
exclude: ${{ steps.setup_github_actions.outputs.exclude }}
autogenerate:
name: Autogenerate
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
needs:
- test
- codeql
permissions:
contents: write
steps:
- uses: actions/create-github-app-token@v1
id: autogenerated
with:
app-id: 1090539
private-key: ${{ secrets.AUTOGENERATED_CONTENT_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.autogenerated.outputs.token }}
- uses: denoland/setup-deno@v2
- uses: actions/setup-node@v4
with:
node-version: 22.x
- run: deno task ci:bump-versions
- run: deno task ci:autogenerate
- name: Run git push
run: |
if [ -n "$(git status --porcelain)" ]; then
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git diff
git add .
git commit -m 'ci: autogenerated changes [skip ci]'
git pull --rebase
git push
fi
publish:
name: Publish
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
needs:
- autogenerate
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v2
- run: deno publish
deploy:
name: Deploy
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
needs:
- preview
- publish
permissions:
id-token: write
pages: write
environment:
name: deployment
url: ${{ steps.deployment.outputs.url }}
steps:
- uses: actions/checkout@v4
with:
ref: main
- uses: actions/configure-pages@v5
- uses: denoland/setup-deno@v2
- run: deno task ci:setup-github-pages
- uses: actions/upload-pages-artifact@v3
- uses: actions/deploy-pages@v4
id: deployment