-
Notifications
You must be signed in to change notification settings - Fork 0
379 lines (342 loc) · 21.5 KB
/
aspnet-core.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
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
name: ASP.NET Core
on:
push:
branches: ["main", "dev*"]
tags: ["*.*.*"]
pull_request:
branches: [main]
jobs:
build:
strategy:
fail-fast: false
matrix:
#runs-on: [macos-11, ubuntu-22.04, windows-latest] disable
runs-on: [ubuntu-22.04, windows-latest]
name: ${{ matrix.runs-on }}
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET 8.0.x, 7.0.x and 6.0.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Setup .NET 9.0.x Preview
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
dotnet-quality: "preview"
- name: dotnet info
run: dotnet --info
- name: Install dotnet tool
run: dotnet tool restore
- name: MinVer
shell: pwsh
id: minver
run: Write-Output "version=$(dotnet minver)" | Out-File -FilePath $Env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Set UI Version
shell: pwsh
run: |
$version = "$(dotnet minver)+$($Env:GITHUB_SHA.SubString(0,7))"
$substitutionVersion = '${1} ' + $version
$versionFilePath = 'src/WebApp/wwwroot/.version'
$content = (Get-Content $versionFilePath -ErrorAction Stop) -replace '^(version:).*$', $substitutionVersion
$substitutionBuildTime = '${1} ' + $(Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ss.fffZ')
$content = $content -replace '^(buildTime:).*$', $substitutionBuildTime
Set-Content -Path $versionFilePath -Value $content -ErrorAction Stop
Write-Output "`n<!-- Build commit $($Env:GITHUB_SHA) / $($Env:GITHUB_REF_NAME) at $($(Get-Date).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ss.fffZ')) -->" | Out-File -FilePath src/WebApp/wwwroot/index.html -Encoding utf8 -Append
- name: Set Docker tag suffix
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
shell: pwsh
run: |
$tagSuffix = if ($Env:RUNNER_OS -eq 'Linux') { '-alpine' } else { if ($Env:RUNNER_OS -eq 'Windows') { '-nanoserver-1809' } }
Write-Output "TAG_SUFFIX=$tagSuffix" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append
Write-Host "Set tag suffix to: $tagSuffix"
- name: Docker meta 6.0
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
id: meta60
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_HUB_REPOS }}
name=netlah/spa-host,enable=${{ startsWith(github.ref, 'refs/tags/') }}
flavor: |
latest=auto
suffix=${{ env.TAG_SUFFIX }}
tags: |
type=raw,enable=${{ github.event_name != 'pull_request' }},priority=999,value=${{ steps.minver.outputs.version }}
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=900,pattern=^(\d+\.\d+(\.\d+)?(-.+)?)$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=880,pattern=^(\d+\.\d+(\.\d+)?)(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=870,pattern=^(\d+\.\d+)(\.\d+)?(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=860,pattern=^(\d+)\.\d+(\.\d+)?(-.+)?$,group=1
type=raw,enable=${{ github.event_name != 'pull_request' }},priority=699,prefix=6.0-,value=${{ steps.minver.outputs.version }}
type=ref,event=branch,priority=500,prefix=6.0-
type=ref,event=pr,priority=500,prefix=6.0-pr-
type=sha,enable=${{ github.event_name != 'pull_request' }},priority=400,prefix=6.0-sha-,format=short
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=600,prefix=6.0-,pattern=^(\d+\.\d+(\.\d+)?(-.+)?)$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=580,prefix=6.0-,pattern=^(\d+\.\d+(\.\d+)?)(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=570,prefix=6.0-,pattern=^(\d+\.\d+)(\.\d+)?(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=560,prefix=6.0-,pattern=^(\d+)\.\d+(\.\d+)?(-.+)?$,group=1
- name: Docker meta sample 6.0
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
id: meta_sample60
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_HUB_SAMPLE_REPOS }}
name=netlah/spa-host-sample,enable=${{ startsWith(github.ref, 'refs/tags/') }}
flavor: |
latest=auto
suffix=${{ env.TAG_SUFFIX }}
tags: |
type=raw,enable=${{ github.event_name != 'pull_request' }},priority=999,value=${{ steps.minver.outputs.version }}
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=900,pattern=^(\d+\.\d+(\.\d+)?(-.+)?)$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=880,pattern=^(\d+\.\d+(\.\d+)?)(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=870,pattern=^(\d+\.\d+)(\.\d+)?(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=860,pattern=^(\d+)\.\d+(\.\d+)?(-.+)?$,group=1
type=raw,enable=${{ github.event_name != 'pull_request' }},priority=699,prefix=6.0-,value=${{ steps.minver.outputs.version }}
type=ref,event=branch,priority=500,prefix=6.0-
type=ref,event=pr,priority=500,prefix=6.0-pr-
type=sha,enable=${{ github.event_name != 'pull_request' }},priority=400,prefix=6.0-sha-,format=short
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=600,prefix=6.0-,pattern=^(\d+\.\d+(\.\d+)?(-.+)?)$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=580,prefix=6.0-,pattern=^(\d+\.\d+(\.\d+)?)(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=570,prefix=6.0-,pattern=^(\d+\.\d+)(\.\d+)?(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=560,prefix=6.0-,pattern=^(\d+)\.\d+(\.\d+)?(-.+)?$,group=1
- name: Docker meta 7.0
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
id: meta70
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_HUB_REPOS }}
name=netlah/spa-host,enable=${{ startsWith(github.ref, 'refs/tags/') }}
flavor: |
latest=auto
suffix=${{ env.TAG_SUFFIX }}
prefix=7.0-
tags: |
type=raw,enable=${{ github.event_name != 'pull_request' }},priority=699,value=${{ steps.minver.outputs.version }}
type=ref,event=branch,priority=500
type=ref,event=pr,priority=500,prefix=7.0-pr-
type=sha,enable=${{ github.event_name != 'pull_request' }},priority=400,prefix=7.0-sha-,format=short
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=600,pattern=^(\d+\.\d+(\.\d+)?(-.+)?)$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=580,pattern=^(\d+\.\d+(\.\d+)?)(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=570,pattern=^(\d+\.\d+)(\.\d+)?(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=560,pattern=^(\d+)\.\d+(\.\d+)?(-.+)?$,group=1
- name: Docker meta sample 7.0
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
id: meta_sample70
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_HUB_SAMPLE_REPOS }}
name=netlah/spa-host-sample,enable=${{ startsWith(github.ref, 'refs/tags/') }}
flavor: |
latest=auto
suffix=${{ env.TAG_SUFFIX }}
prefix=7.0-
tags: |
type=raw,enable=${{ github.event_name != 'pull_request' }},priority=699,value=${{ steps.minver.outputs.version }}
type=ref,event=branch,priority=500
type=ref,event=pr,priority=500,prefix=7.0-pr-
type=sha,enable=${{ github.event_name != 'pull_request' }},priority=400,prefix=7.0-sha-,format=short
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=600,pattern=^(\d+\.\d+(\.\d+)?(-.+)?)$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=580,pattern=^(\d+\.\d+(\.\d+)?)(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=570,pattern=^(\d+\.\d+)(\.\d+)?(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=560,pattern=^(\d+)\.\d+(\.\d+)?(-.+)?$,group=1
- name: Docker meta 8.0
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
id: meta80
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_HUB_REPOS }}
name=netlah/spa-host,enable=${{ startsWith(github.ref, 'refs/tags/') }}
flavor: |
latest=auto
suffix=${{ env.TAG_SUFFIX }}
prefix=8.0-
tags: |
type=raw,enable=${{ github.event_name != 'pull_request' }},priority=699,value=${{ steps.minver.outputs.version }}
type=ref,event=branch,priority=500
type=ref,event=pr,priority=500,prefix=8.0-pr-
type=sha,enable=${{ github.event_name != 'pull_request' }},priority=400,prefix=8.0-sha-,format=short
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=600,pattern=^(\d+\.\d+(\.\d+)?(-.+)?)$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=580,pattern=^(\d+\.\d+(\.\d+)?)(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=570,pattern=^(\d+\.\d+)(\.\d+)?(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=560,pattern=^(\d+)\.\d+(\.\d+)?(-.+)?$,group=1
- name: Docker meta sample 8.0
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
id: meta_sample80
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_HUB_SAMPLE_REPOS }}
name=netlah/spa-host-sample,enable=${{ startsWith(github.ref, 'refs/tags/') }}
flavor: |
latest=auto
suffix=${{ env.TAG_SUFFIX }}
prefix=8.0-
tags: |
type=raw,enable=${{ github.event_name != 'pull_request' }},priority=699,value=${{ steps.minver.outputs.version }}
type=ref,event=branch,priority=500
type=ref,event=pr,priority=500,prefix=8.0-pr-
type=sha,enable=${{ github.event_name != 'pull_request' }},priority=400,prefix=8.0-sha-,format=short
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=600,pattern=^(\d+\.\d+(\.\d+)?(-.+)?)$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=580,pattern=^(\d+\.\d+(\.\d+)?)(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=570,pattern=^(\d+\.\d+)(\.\d+)?(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=560,pattern=^(\d+)\.\d+(\.\d+)?(-.+)?$,group=1
- name: Docker meta 9.0
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
id: meta90
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_HUB_REPOS }}
name=netlah/spa-host,enable=${{ startsWith(github.ref, 'refs/tags/') }}
flavor: |
latest=auto
suffix=${{ env.TAG_SUFFIX }}
prefix=9.0-
tags: |
type=raw,enable=${{ github.event_name != 'pull_request' }},priority=699,value=${{ steps.minver.outputs.version }}
type=ref,event=branch,priority=500
type=ref,event=pr,priority=500,prefix=9.0-pr-
type=sha,enable=${{ github.event_name != 'pull_request' }},priority=400,prefix=9.0-sha-,format=short
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=600,pattern=^(\d+\.\d+(\.\d+)?(-.+)?)$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=590,pattern=^(\d+\.\d+(\.\d+)?)(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=570,pattern=^(\d+\.\d+)(\.\d+)?(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=560,pattern=^(\d+)\.\d+(\.\d+)?(-.+)?$,group=1
- name: Docker meta sample 9.0
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
id: meta_sample90
uses: docker/metadata-action@v5
with:
images: |
${{ secrets.DOCKER_HUB_SAMPLE_REPOS }}
name=netlah/spa-host-sample,enable=${{ startsWith(github.ref, 'refs/tags/') }}
flavor: |
latest=auto
suffix=${{ env.TAG_SUFFIX }}
prefix=9.0-
tags: |
type=raw,enable=${{ github.event_name != 'pull_request' }},priority=699,value=${{ steps.minver.outputs.version }}
type=ref,event=branch,priority=500
type=ref,event=pr,priority=500,prefix=9.0-pr-
type=sha,enable=${{ github.event_name != 'pull_request' }},priority=400,prefix=9.0-sha-,format=short
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=600,pattern=^(\d+\.\d+(\.\d+)?(-.+)?)$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=590,pattern=^(\d+\.\d+(\.\d+)?)(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=570,pattern=^(\d+\.\d+)(\.\d+)?(-.+)?$,group=1
type=match,enable=${{ startsWith(github.ref, 'refs/tags/') }},priority=560,pattern=^(\d+)\.\d+(\.\d+)?(-.+)?$,group=1
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test -c Release --no-build --verbosity normal
- name: Publish
shell: pwsh
run: |
foreach ($framework in @('net6.0', 'net7.0', 'net8.0', 'net9.0')) {
dotnet publish src/WebApp -c Release -f $framework --no-build -o "artifacts/$($framework)/app"
Copy-Item -Force -Path shared/appsettings.Development.json -Destination "artifacts/$($framework)/app/" -ErrorAction Stop -Verbose
}
- name: Split sample wwwroot
shell: pwsh
run: |
foreach ($framework in @('net6.0', 'net7.0', 'net8.0', 'net9.0')) {
$webFolder = New-Item -Name "artifacts/$($framework)/wwwroot" -ItemType 'Directory' -ErrorAction Stop
Move-Item -Force -Path "artifacts/$($framework)/app/wwwroot/*" -Destination "$webFolder/" -Exclude favicon.ico -ErrorAction Stop -Verbose
}
- name: Copy Dockerfile
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
shell: pwsh
run: |
foreach ($framework in @('net6.0', 'net7.0', 'net8.0', 'net9.0')) {
Copy-Item -Recurse -Force -Path '.dockerignore',".docker-$( if ($Env:RUNNER_OS -eq 'Linux') { 'linux' } else { 'windows' } )/*" -Destination "artifacts/$($framework)/" -ErrorAction Stop -Verbose
}
- name: Enabling Docker Daemon With experimental features
if: ${{ success() && runner.os == 'Linux' }}
run: |
echo 'Before update daemon.json'
sudo cat /etc/docker/daemon.json
sudo bash -c 'echo "{ "\""exec-opts"\"": ["\""native.cgroupdriver=cgroupfs"\""], "\""cgroup-parent"\"": "\""/actions_job"\"", "\""experimental"\"": true }" > /etc/docker/daemon.json'
echo 'After update daemon.json'
sudo cat /etc/docker/daemon.json
sudo systemctl restart docker.service
- name: Set up Docker Buildx
if: ${{ success() && (runner.os == 'Linux') }}
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Build and Push 6.0
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
id: build60
shell: pwsh
run: ./docker-build.ps1 -Context ./artifacts/net6.0 -Squash -Tags "${{ steps.meta60.outputs.tags }}" -Labels "${{ steps.meta60.outputs.labels }}"
- name: Build and Push Sample 6.0
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
shell: pwsh
run: ./docker-build.ps1 -Context ./artifacts/net6.0 -NoPull -Dockerfile ./artifacts/net6.0/Dockerfile-sample -Tags "${{ steps.meta_sample60.outputs.tags }}" -Labels "${{ steps.meta_sample60.outputs.labels }}" -BuildArgs "SPAHOST_IMAGE=$Env:SPAHOST_IMAGE"
env:
SPAHOST_IMAGE: ${{ steps.build60.outputs.image }}
- name: Build and Push 7.0
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
id: build70
shell: pwsh
run: |
$aspnetImageTag70 = if ($Env:RUNNER_OS -eq 'Linux') { '7.0-alpine' } else { '7.0-nanoserver-1809' }
./docker-build.ps1 -Context ./artifacts/net7.0 -Squash -Tags "${{ steps.meta70.outputs.tags }}" -Labels "${{ steps.meta70.outputs.labels }}" -BuildArgs "ASPNET_IMAGE_TAG=$aspnetImageTag70"
- name: Build and Push Sample 7.0
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
shell: pwsh
run: ./docker-build.ps1 -Context ./artifacts/net7.0 -NoPull -Dockerfile ./artifacts/net7.0/Dockerfile-sample -Tags "${{ steps.meta_sample70.outputs.tags }}" -Labels "${{ steps.meta_sample70.outputs.labels }}" -BuildArgs "SPAHOST_IMAGE=$Env:SPAHOST_IMAGE"
env:
SPAHOST_IMAGE: ${{ steps.build70.outputs.image }}
- name: Build and Push 8.0
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
id: build80
shell: pwsh
run: |
$aspnetImageTag80 = if ($Env:RUNNER_OS -eq 'Linux') { '8.0-alpine' } else { '8.0-nanoserver-1809' }
./docker-build.ps1 -Context ./artifacts/net8.0 -Squash -Tags "${{ steps.meta80.outputs.tags }}" -Labels "${{ steps.meta80.outputs.labels }}" -BuildArgs "ASPNET_IMAGE_TAG=$aspnetImageTag80"
- name: Build and Push Sample 8.0
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
shell: pwsh
run: ./docker-build.ps1 -Context ./artifacts/net8.0 -NoPull -Dockerfile ./artifacts/net8.0/Dockerfile-sample -Tags "${{ steps.meta_sample80.outputs.tags }}" -Labels "${{ steps.meta_sample80.outputs.labels }}" -BuildArgs "SPAHOST_IMAGE=$Env:SPAHOST_IMAGE"
env:
SPAHOST_IMAGE: ${{ steps.build80.outputs.image }}
- name: Build and Push 9.0
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
id: build90
shell: pwsh
run: |
$aspnetImageTag90 = if ($Env:RUNNER_OS -eq 'Linux') { '9.0-alpine' } else { '9.0-preview-nanoserver-1809' }
./docker-build.ps1 -Context ./artifacts/net9.0 -Squash -Tags "${{ steps.meta90.outputs.tags }}" -Labels "${{ steps.meta90.outputs.labels }}" -BuildArgs "ASPNET_IMAGE_TAG=$aspnetImageTag90"
- name: Build and Push Sample 9.0
if: ${{ success() && (runner.os == 'Linux' || runner.os == 'Windows') }}
shell: pwsh
run: ./docker-build.ps1 -Context ./artifacts/net9.0 -NoPull -Dockerfile ./artifacts/net9.0/Dockerfile-sample -Tags "${{ steps.meta_sample90.outputs.tags }}" -Labels "${{ steps.meta_sample90.outputs.labels }}" -BuildArgs "SPAHOST_IMAGE=$Env:SPAHOST_IMAGE"
env:
SPAHOST_IMAGE: ${{ steps.build90.outputs.image }}
- name: Pack
run: dotnet pack src/Hosting/Hosting.csproj -c Release -o ./artifacts/packages/ --no-build --verbosity normal
- if: ${{ success() && runner.os == 'Windows' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) }}
name: Push MyGet, CloudSmith and GitHub registry
run: |
dotnet nuget push .\artifacts\packages\*.nupkg -s https://www.myget.org/F/netlah/api/v2/package -k ${{ secrets.MYGET }}
dotnet nuget push .\artifacts\packages\*.nupkg -s https://nuget.pkg.github.com/NetLah/index.json --skip-duplicate -k ${{ secrets.PUSH_GITHUB_REGISTRY_TOKEN }}
dotnet nuget push .\artifacts\packages\*.nupkg -s https://nuget.cloudsmith.io/netlah/net-main1/v3/index.json --skip-duplicate -k ${{ secrets.PUSH_CLOUDSMITH_TOKEN }}
- name: Push CloudSmith and GitHub registry dev
if: ${{ success() && runner.os == 'Windows' && (startsWith(github.ref, 'refs/heads/dev')) }}
run: |
dotnet nuget push .\artifacts\packages\*.nupkg -s https://nuget.pkg.github.com/NetLah/index.json --skip-duplicate -k ${{ secrets.PUSH_GITHUB_REGISTRY_TOKEN }}
dotnet nuget push .\artifacts\packages\*.nupkg -s https://nuget.cloudsmith.io/netlah/net-dev1/v3/index.json --skip-duplicate -k ${{ secrets.PUSH_CLOUDSMITH_TOKEN }}