-
Notifications
You must be signed in to change notification settings - Fork 6
341 lines (284 loc) · 9.32 KB
/
publish.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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
name: Publish
env:
NUGET_OUTPUT: ./Artifacts/NuGet
DOTNET8_VERSION: "8.0.405"
DOTNET_VERSION: "9.0.x"
DOTNET_X64_CACHE: "dotnet-x64-cache-${{ github.sha }}"
DOTNET_ARM64_CACHE: "dotnet-arm64-cache-${{ github.sha }}"
WORKBENCH_CACHE: "web-cache-${{ github.sha }}"
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release'
required: true
default: '0.0.0'
type: string
release-notes:
description: 'Release notes'
required: true
default: 'No release notes'
type: string
logLevel:
description: 'Log level'
required: true
default: 'warning'
type: choice
options:
- info
- warning
- debug
pull_request:
types: [closed]
branches:
- "**"
paths:
- "**"
- "!Docker/BaseDevelopment/**"
jobs:
dotnet-x64:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .Net
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
${{ env.DOTNET8_VERSION }}
${{ env.DOTNET_VERSION }}
- uses: actions/cache@v3
id: dotnet-x64-output
with:
path: ./Source/Kernel/Server/out/x64
key: ${{ env.DOTNET_X64_CACHE }}
- name: Build x64 Kernel - self contained, ready to run
working-directory: ./Source/Kernel/Server
run: dotnet publish -c Release -f net9.0 -r linux-x64 -p:PublishReadyToRun=true -p:DisableProxyGenerator=true --self-contained -o out/x64
dotnet-arm64:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .Net
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
${{ env.DOTNET8_VERSION }}
${{ env.DOTNET_VERSION }}
- uses: actions/cache@v3
id: dotnet-arm64-output
with:
path: ./Source/Kernel/Server/out/arm64
key: ${{ env.DOTNET_ARM64_CACHE }}
- name: Build arm64 Kernel - self contained, ready to run
working-directory: ./Source/Kernel/Server
run: dotnet publish -c Release -f net9.0 -r linux-arm64 -p:PublishReadyToRun=true -p:DisableProxyGenerator=true --self-contained -o out/arm64
workbench:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/cache@v3
id: workbench-output
with:
path: ./Source/Workbench/Web/wwwroot
key: ${{ env.WORKBENCH_CACHE }}
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20.x
registry-url: "https://registry.npmjs.org"
- uses: actions/cache@v3
id: yarn-cache
with:
path: |
.yarn/cache
**/node_modules
**/.eslintcache
**/yarn.lock
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
- name: Yarn install
working-directory: ./Source/Workbench/Web
run: yarn install
- name: Build Workbench
working-directory: ./Source/Workbench/Web
run: |
yarn build
release:
runs-on: ubuntu-latest
needs: [dotnet-x64, dotnet-arm64, workbench]
outputs:
version: ${{ steps.release.outputs.version }}
publish: ${{ steps.release.outputs.should-publish }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Release
id: release
uses: cratis/release-action@v1
with:
version: ${{ github.event.inputs.version }}
release-notes: ${{ github.event.inputs.release-notes }}
publish-dotnet-packages:
if: needs.release.outputs.publish == 'true'
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/cache@v3
id: workbench-output
with:
path: ./Source/Workbench/Web/wwwroot
key: ${{ env.WORKBENCH_CACHE }}
- name: Setup .Net
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
${{ env.DOTNET8_VERSION }}
${{ env.DOTNET_VERSION }}
- name: Remove any existing artifacts
run: rm -rf ${{ env.NUGET_OUTPUT }}
- name: Build
run: dotnet build --configuration Release
- name: Create NuGet packages
run: dotnet pack --no-build --configuration Release -o ${{ env.NUGET_OUTPUT }} -p:PackageVersion=${{ needs.release.outputs.version }}
- name: Push NuGet packages
run: dotnet nuget push --skip-duplicate '${{ env.NUGET_OUTPUT }}/*.nupkg' --timeout 900 --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
publish-docker-production:
if: needs.release.outputs.publish == 'true'
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/cache@v3
id: dotnet-x64-output
with:
path: ./Source/Kernel/Server/out/x64
key: ${{ env.DOTNET_X64_CACHE }}
- uses: actions/cache@v3
id: dotnet-arm64-output
with:
path: ./Source/Kernel/Server/out/arm64
key: ${{ env.DOTNET_ARM64_CACHE }}
- uses: actions/cache@v3
id: workbench-output
with:
path: ./Source/Workbench/Web/wwwroot
key: ${{ env.WORKBENCH_CACHE }}
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Production Docker Image
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Docker/Production/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
cratis/chronicle:${{ needs.release.outputs.version }}
cratis/chronicle:latest
build-args: |
VERSION=${{ needs.release.outputs.version }}
publish-docker-workbench:
if: needs.release.outputs.publish == 'true'
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/cache@v3
id: workbench-output
with:
path: ./Source/Workbench/Web/wwwroot
key: ${{ env.WORKBENCH_CACHE }}
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Workbench Image
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Docker/Workbench/Dockerfile
push: true
tags: |
cratis/chronicle:${{ needs.release.outputs.version }}-workbench
cratis/chronicle:latest-workbench
build-args: |
VERSION=${{ needs.release.outputs.version }}
publish-docker-development:
if: needs.release.outputs.publish == 'true'
runs-on: ubuntu-latest
needs: [release]
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/cache@v3
id: dotnet-x64-output
with:
path: ./Source/Kernel/Server/out/x64
key: ${{ env.DOTNET_X64_CACHE }}
- uses: actions/cache@v3
id: dotnet-arm64-output
with:
path: ./Source/Kernel/Server/out/arm64
key: ${{ env.DOTNET_ARM64_CACHE }}
- uses: actions/cache@v3
id: workbench-output
with:
path: ./Source/Workbench/Web/wwwroot
key: ${{ env.WORKBENCH_CACHE }}
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@master
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build Development Docker Image
uses: docker/build-push-action@v5
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Docker/Development/Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: |
cratis/chronicle:${{ needs.release.outputs.version }}-development
cratis/chronicle:latest-development
build-args: |
VERSION=${{ needs.release.outputs.version }}
- name: Trigger Documentation Build
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.PAT_DOCUMENTATION }}
repository: cratis/documentation
event-type: build-docs