Repository navigation
494 lines (445 loc) · 23.2 KB
/
Copy pathrelease.yml
File metadata and controls
494 lines (445 loc) · 23.2 KB
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
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
# Publishes a release (decisions 127 to 130). For each Rock release in
# release/rock-releases.json, it builds that Rock, writes every dataset's package, verifies them,
# and runs the publishing gate. It packs the loader NuGet package. Then, behind the
# "release" environment, it signs the package index with Spark's key in Azure Key Vault, pushes the
# loader to nuget.org, and uploads the packages, their receipts, and the signed index to Azure Blob
# Storage, the index last.
#
# A version tag (v1.0.0, or v1.1.0-beta.1 for a prerelease) publishes. A manual run is a dry run
# unless "publish" is ticked, and a run that publishes must be on main and name its version.
# The setup it needs (the environment, the Azure identity, nuget.org trusted publishing, and these
# variables) is in docs/maintaining.md, under "Publishing a release":
# vars.AZURE_CLIENT_ID, vars.AZURE_TENANT_ID, vars.AZURE_SUBSCRIPTION_ID,
# vars.AZURE_STORAGE_ACCOUNT, vars.NUGET_USER, vars.AZURE_KEY_VAULT_NAME, vars.INDEX_SIGNING_KEY
name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
version:
description: "The version, without the v (for example 1.0.0 or 1.1.0-beta.1). Needed to publish."
required: false
default: ""
publish:
description: "Publish to nuget.org and Azure. Only from main. Leave it off for a dry run."
type: boolean
default: false
permissions:
contents: read
env:
DOTNET_NOLOGO: "true"
DOTNET_CLI_TELEMETRY_OPTOUT: "true"
CONTAINER: sampledata
# Git Bash on Windows rewrites any argument that starts with "/" into a Windows path before it reaches
# a Windows program, so an MD5 such as /2mt41CZzOhoXL0bSq+OpA== reached az as
# C:/Program Files/Git/2mt41CZzOhoXL0bSq+OpA== and Azure refused the upload (the v0.1.0-alpha.15
# run). Every path these steps pass is relative or already a Windows path, so nothing needs the
# rewrite. Both settings turn it off; the Ubuntu job ignores them.
MSYS_NO_PATHCONV: "1"
MSYS2_ARG_CONV_EXCL: "*"
jobs:
plan:
name: Plan
runs-on: ubuntu-latest
outputs:
version: ${{ steps.plan.outputs.version }}
publish: ${{ steps.plan.outputs.publish }}
prerelease: ${{ steps.plan.outputs.prerelease }}
releases: ${{ steps.plan.outputs.releases }}
steps:
- uses: actions/checkout@v4
- name: Read the version and the Rock releases
id: plan
shell: bash
env:
EVENT: ${{ github.event_name }}
REF: ${{ github.ref }}
REF_NAME: ${{ github.ref_name }}
INPUT_VERSION: ${{ inputs.version }}
INPUT_PUBLISH: ${{ inputs.publish }}
RUN_NUMBER: ${{ github.run_number }}
run: |
set -euo pipefail
if [[ "$EVENT" = "push" && "$REF" == refs/tags/* ]]; then
version="${REF_NAME#v}"
publish=true
else
publish="${INPUT_PUBLISH:-false}"
version="${INPUT_VERSION#v}"
if [ "$publish" = "true" ]; then
[ "$REF" = "refs/heads/main" ] || { echo "::error::A run that publishes must be on main, not $REF."; exit 1; }
[ -n "$version" ] || { echo "::error::A run that publishes needs a version."; exit 1; }
fi
version="${version:-0.0.0-dryrun.$RUN_NUMBER}"
fi
# A NuGet version: three numbers, then an optional prerelease label.
if ! [[ "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z]+(\.[0-9A-Za-z]+)*)?$ ]]; then
echo "::error::$version is not a version like 1.0.0 or 1.1.0-beta.1."
exit 1
fi
# A release's loader must load its own packages (decision 158).
if [ "$publish" = "true" ]; then
node release/check-minimum-loader.js --version "$version"
fi
# The index signing code signs and checks a sample with a throwaway key, and the keys file
# has an active key and a spare (decision 172).
node release/sign-index.js --self-test
prerelease=false
[[ "$version" == *-* ]] && prerelease=true
# One Rock release per major release, whose packages go under rock-{major} (decision 52).
releases=$(jq -c '[.releases[] | { version, ref, major: (.version | split(".")[0] | tonumber) }]' release/rock-releases.json)
if [ "$(jq '[.[].major] | length != (unique | length)' <<< "$releases")" = "true" ]; then
echo "::error::release/rock-releases.json lists two Rock releases for one major release."
exit 1
fi
{
echo "version=$version"
echo "publish=$publish"
echo "prerelease=$prerelease"
echo "releases=$releases"
} >> "$GITHUB_OUTPUT"
echo "Version $version, publish $publish, prerelease $prerelease, Rock releases $releases"
packages:
name: Packages for Rock ${{ matrix.rock.version }}
needs: plan
# A GitHub-hosted runner by default. vars.PACKAGES_RUNNER, a JSON list of labels such as
# ["self-hosted","windows","rock-build"], moves it to a self-hosted runner (docs/maintaining.md).
runs-on: ${{ vars.PACKAGES_RUNNER && fromJSON(vars.PACKAGES_RUNNER) || 'windows-2025' }}
timeout-minutes: 300
strategy:
fail-fast: false
matrix:
rock: ${{ fromJSON(needs.plan.outputs.releases) }}
env:
ROCK_VERSION: ${{ matrix.rock.version }}
ROCK_MAJOR: ${{ matrix.rock.major }}
ROCK_REF: ${{ matrix.rock.ref }}
steps:
- uses: actions/checkout@v4
# GitHub's runners keep UTC, so midnight falls at 5pm Arizona time, and a release started in the
# afternoon could cross it mid-verify (the v0.1.0-alpha.11 run). On Spark's time zone, SQL Server,
# Rock, and verify all share one date that only changes at midnight Arizona time. Set before SQL
# Server is installed, so it starts on this zone. A self-hosted runner keeps its own zone.
- name: Set the runner to Arizona time
if: runner.environment == 'github-hosted'
run: |
tzutil /s "US Mountain Standard Time"
Get-TimeZone | Select-Object -ExpandProperty Id
# Outside the workspace: an untracked Rock folder would mark every package as built from
# uncommitted changes, and the publishing gate refuses those.
- name: Check out Rock ${{ matrix.rock.version }}
shell: bash
run: |
set -euo pipefail
rock="$RUNNER_TEMP/rock"
git config --global core.longpaths true
git init -q "$rock"
git -C "$rock" remote add origin https://github.com/SparkDevNetwork/Rock.git
git -C "$rock" fetch -q --depth 1 --no-tags origin "$ROCK_REF"
git -C "$rock" checkout -q FETCH_HEAD
found=$(sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p' "$rock/Directory.Build.props" | head -1)
[ "$found" = "$ROCK_VERSION" ] || { echo "::error::$ROCK_REF is Rock $found, not $ROCK_VERSION."; exit 1; }
echo "ROCK_PATH=$(cygpath -w "$rock")" >> "$GITHUB_ENV"
echo "Rock $found at $(git -C "$rock" rev-parse HEAD)"
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
# Rock's Obsidian projects need Node 24.5 or later.
- uses: actions/setup-node@v4
with:
node-version: 24
- uses: microsoft/setup-msbuild@v2
- uses: NuGet/setup-nuget@v2
# RockWeb is a website, so MSBuild's restore skips its packages.config, and "nuget restore
# Rock.sln" skips it too. Without these packages RockWeb's App_Code cannot compile. They also
# hold ef6.exe, which the verify tool needs.
- name: Restore RockWeb's packages
working-directory: ${{ env.ROCK_PATH }}
run: nuget restore RockWeb/packages.config -SolutionDirectory . -NonInteractive
# Each RockWeb\Bin\*.refresh names a restored DLL for Bin. Visual Studio copies them, but a
# command-line website build cannot resolve the netstandard2.0 ones (MSB3268), so Ical.Net and
# others never reach Bin and App_Code fails to compile. Copy them first, as Visual Studio does.
# A .refresh for a package RockWeb no longer lists is skipped.
- name: Copy RockWeb's referenced DLLs into Bin
working-directory: ${{ env.ROCK_PATH }}
run: |
$copied = 0
Get-ChildItem RockWeb\Bin -Filter *.refresh | ForEach-Object {
$dll = Join-Path $_.DirectoryName $_.BaseName
$source = Join-Path (Resolve-Path RockWeb) (Get-Content $_.FullName -Raw).Trim()
if (Test-Path $dll) { return }
if (Test-Path $source) { Copy-Item $source $dll; $copied++ }
else { Write-Output "Skipped $($_.Name): $source is not restored." }
}
Write-Output "Copied $copied DLLs into RockWeb\Bin."
# dotnet build cannot build RockWeb (MSB4249), so use Visual Studio's MSBuild. The verify tool
# needs RockWeb\bin.
- name: Build Rock
working-directory: ${{ env.ROCK_PATH }}
run: msbuild Rock.sln -m -restore -p:RestorePackagesConfig=true -v:minimal -nologo
# A self-hosted runner has its own SQL Server, where the runner's account is a sysadmin.
- name: Start SQL Server
if: runner.environment == 'github-hosted'
uses: potatoqualitee/mssqlsuite@bc850f242e5fe551e36cea6fa4bed608c58fa489 # v2
with:
install: sqlengine
version: "2025"
sa-password: ${{ format('Rsd.{0}.{1}', github.run_id, github.run_attempt) }}
- name: Check SQL Server sign-in
run: sqlcmd -S localhost -E -C -Q "SELECT @@VERSION, SUSER_SNAME() AS [Login], IS_SRVROLEMEMBER('sysadmin') AS [IsSysAdmin];"
# SQL Server installs its files on C:, which has too little free space for a verify run: the trusted base,
# its backup, each loaded copy (Full 7 loads in one transaction, so its log grows large), and the Rock
# Cleanup snapshot. Full 7 outgrew it in the v0.1.0-alpha.13 dry run ("PRIMARY filegroup is full").
# D: holds the workspace and has room, so new databases, backups, and tempdb go there.
- name: Keep SQL Server's files on D
if: runner.environment == 'github-hosted'
run: |
$folder = "D:\sqldata"
New-Item -ItemType Directory -Force $folder | Out-Null
icacls $folder /grant "NT SERVICE\MSSQLSERVER:(OI)(CI)F" | Out-Null
foreach ($name in "DefaultData", "DefaultLog", "BackupDirectory") {
sqlcmd -S localhost -E -C -b -Q "EXEC master.dbo.xp_instance_regwrite N'HKEY_LOCAL_MACHINE', N'Software\Microsoft\MSSQLServer\MSSQLServer', N'$name', REG_SZ, N'$folder';"
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
}
$moves = sqlcmd -S localhost -E -C -h -1 -W -Q "SET NOCOUNT ON; SELECT 'ALTER DATABASE [tempdb] MODIFY FILE ( NAME = N''' + [name] + ''', FILENAME = N''$folder\' + [name] + CASE [type] WHEN 1 THEN '.ldf' ELSE '.mdf' END + ''' );' FROM sys.master_files WHERE [database_id] = DB_ID( 'tempdb' );"
sqlcmd -S localhost -E -C -b -Q ($moves -join " ")
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Restart-Service MSSQLSERVER -Force
for ($i = 0; $i -lt 30; $i++) {
sqlcmd -S localhost -E -C -Q "SELECT 1" *> $null
if ($LASTEXITCODE -eq 0) { break }
Start-Sleep -Seconds 2
}
sqlcmd -S localhost -E -C -b -Q "SELECT SERVERPROPERTY('InstanceDefaultDataPath') AS [Data], SERVERPROPERTY('InstanceDefaultLogPath') AS [Log], SERVERPROPERTY('InstanceDefaultBackupPath') AS [Backup], ( SELECT TOP 1 [physical_name] FROM sys.master_files WHERE [database_id] = DB_ID( 'tempdb' ) ) AS [Tempdb];"
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Get-PSDrive C, D | Format-Table Name, @{ n = "FreeGB"; e = { [math]::Round( $_.Free / 1GB, 1 ) } }, @{ n = "UsedGB"; e = { [math]::Round( $_.Used / 1GB, 1 ) } }
# Each package serves every dot release of its major, so it is written and published under rock-{major}.
- name: Write the packages
run: dotnet run --project builder -c Release -- --rock "$env:ROCK_PATH" --out "packages/rock-$env:ROCK_MAJOR"
- name: Verify the packages
run: dotnet run --project verify -c Release -- --rock "$env:ROCK_PATH" --packages "packages/rock-$env:ROCK_MAJOR" --run ci
# How much room verify left, so a dataset that grows toward the limit shows before it fails.
- name: Free space after verify
if: always()
run: Get-PSDrive C, D | Format-Table Name, @{ n = "FreeGB"; e = { [math]::Round( $_.Free / 1GB, 1 ) } }, @{ n = "UsedGB"; e = { [math]::Round( $_.Used / 1GB, 1 ) } }
- name: Publishing gate
run: dotnet run --project verify -c Release --no-build -- --check-receipts "packages/rock-$env:ROCK_MAJOR"
- uses: actions/upload-artifact@v4
if: always()
with:
name: rock-${{ matrix.rock.major }}
path: packages/rock-${{ matrix.rock.major }}
if-no-files-found: warn
retention-days: 14
loader:
name: Loader NuGet package
needs: plan
runs-on: windows-2025
timeout-minutes: 30
outputs:
package-id: ${{ steps.id.outputs.package-id }}
env:
VERSION: ${{ needs.plan.outputs.version }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
# Publish passes MD5s and other computed values from Git Bash to Windows programs. This job runs
# on dry runs too, so a shell that still rewrites them fails here, before any tag.
- name: Check that values reach Windows programs unchanged
shell: bash
run: |
set -euo pipefail
sent="/2mt41CZzOhoXL0bSq+OpA=="
got=$(node -e 'process.stdout.write(process.argv[1])' "$sent")
[ "$got" = "$sent" ] || { echo "::error::Git Bash rewrote $sent as $got. Set MSYS_NO_PATHCONV for this job."; exit 1; }
echo "Passed $sent unchanged."
# The .NET Framework build Rock uses must derive the same keys, hashes, and draws as .NET 10.
- name: Check the .NET Framework build
run: |
dotnet run --project loader-compat-check -c Release -f net10.0
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
dotnet run --project loader-compat-check -c Release -f net472
# The .NET SDK adds Source Link for GitHub on its own. ContinuousIntegrationBuild makes the
# build deterministic and maps paths to the repository.
- name: Pack the loader
run: >
dotnet pack loader/RockSampleData.Loader.csproj -c Release -o artifacts/nuget
-p:Version=$env:VERSION
-p:ContinuousIntegrationBuild=true
-p:PublishRepositoryUrl=true
-p:EmbedUntrackedSources=true
-p:IncludeSymbols=true
-p:SymbolPackageFormat=snupkg
# The package ID lives only in the project file, so the files below are named from it.
- name: Read the package ID
id: id
shell: bash
run: echo "package-id=$(dotnet msbuild loader/RockSampleData.Loader.csproj -getProperty:PackageId -nologo | tr -d '\r')" >> "$GITHUB_OUTPUT"
- name: Check the package
shell: bash
env:
PACKAGE_ID: ${{ steps.id.outputs.package-id }}
run: |
set -euo pipefail
package="artifacts/nuget/$PACKAGE_ID.$VERSION.nupkg"
[ -f "$package" ] || { echo "::error::$package was not written."; exit 1; }
[ -f "${package%.nupkg}.snupkg" ] || { echo "::error::The symbols package was not written."; exit 1; }
# Windows' own tar reads zips; the tar in Git Bash does not.
tar=/c/Windows/System32/tar.exe
contents=$("$tar" -tf "$package")
for expected in LICENSE.md README.md lib/net472/RockSampleData.Loader.dll lib/net10.0/RockSampleData.Loader.dll; do
grep -qx "$expected" <<< "$contents" || { echo "::error::The package has no $expected."; exit 1; }
done
nuspec=$("$tar" -xOf "$package" "$PACKAGE_ID.nuspec")
grep -Eq "<repository type=\"git\" url=\"https://github.com/$GITHUB_REPOSITORY(\.git)?\" .*commit=\"$GITHUB_SHA\"" <<< "$nuspec" \
|| { echo "::error::The package does not name this repository and commit."; echo "$nuspec"; exit 1; }
# Extract each .pdb to a file before searching it. Piping tar into grep -q failed at random:
# grep stops at the first match, tar then fails writing to the closed pipe, and pipefail
# reports that as a missing Source Link (the v0.1.0-alpha.9 run).
pdb="$RUNNER_TEMP/RockSampleData.Loader.pdb"
for framework in net472 net10.0; do
"$tar" -xOf "${package%.nupkg}.snupkg" "lib/$framework/RockSampleData.Loader.pdb" > "$pdb"
grep -aq "https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_SHA/" "$pdb" \
|| { echo "::error::The $framework symbols have no Source Link to this commit."; exit 1; }
done
echo "$contents"
- uses: actions/upload-artifact@v4
with:
name: loader-nuget
path: artifacts/nuget
if-no-files-found: error
retention-days: 14
publish:
name: Publish
needs: [plan, packages, loader]
if: needs.plan.outputs.publish == 'true'
runs-on: windows-2025
timeout-minutes: 60
environment: release
concurrency:
group: release-publish
cancel-in-progress: false
permissions:
contents: read
id-token: write
env:
VERSION: ${{ needs.plan.outputs.version }}
PRERELEASE: ${{ needs.plan.outputs.prerelease }}
ACCOUNT: ${{ vars.AZURE_STORAGE_ACCOUNT }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
- uses: actions/setup-node@v4
with:
node-version: 24
- uses: actions/download-artifact@v4
with:
pattern: rock-*
path: packages
- uses: actions/download-artifact@v4
with:
name: loader-nuget
path: artifacts/nuget
# The same check as the loader job's, before this job signs or publishes anything.
- name: Check that values reach Windows programs unchanged
shell: bash
run: |
set -euo pipefail
sent="/2mt41CZzOhoXL0bSq+OpA=="
got=$(node -e 'process.stdout.write(process.argv[1])' "$sent")
[ "$got" = "$sent" ] || { echo "::error::Git Bash rewrote $sent as $got. Set MSYS_NO_PATHCONV for this job."; exit 1; }
echo "Passed $sent unchanged."
# The gate again, on the exact bytes this job uploads.
- name: Publishing gate
shell: bash
run: |
set -euo pipefail
dotnet build verify -c Release -v:quiet -nologo
for folder in packages/rock-*; do
dotnet run --project verify -c Release --no-build -- --check-receipts "$folder"
done
- name: Sign in to Azure
uses: azure/login@v2
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
# The index is merged and signed before anything is published, so a signing failure publishes
# nothing. merge-index.js reads only a hosted index Spark signed, and sign-index.js checks its own
# signature with release/index-signing-keys.json before it writes the file (decision 172).
- name: Sign the package index
shell: bash
env:
VAULT: ${{ vars.AZURE_KEY_VAULT_NAME }}
SIGNING_KEY: ${{ vars.INDEX_SIGNING_KEY }}
run: |
set -euo pipefail
mkdir -p index
az storage blob download --auth-mode login --account-name "$ACCOUNT" -c "$CONTAINER" -n packages/index.json -f index/hosted.json --only-show-errors -o none 2>/dev/null \
|| { echo "No index is hosted yet."; rm -f index/hosted.json; }
node release/merge-index.js --packages packages --version "$VERSION" --commit "$GITHUB_SHA" --index index/hosted.json --out index/unsigned.json
node release/sign-index.js --in index/unsigned.json --out index/index.json --vault-name "$VAULT" --key "$SIGNING_KEY"
- name: Sign in to nuget.org
id: nuget
uses: NuGet/login@v1
with:
user: ${{ vars.NUGET_USER }}
# A version already on nuget.org is skipped, so a re-run after a later failure is safe.
- name: Push the loader to nuget.org
shell: bash
env:
NUGET_API_KEY: ${{ steps.nuget.outputs.NUGET_API_KEY }}
PACKAGE_ID: ${{ needs.loader.outputs.package-id }}
run: dotnet nuget push "artifacts/nuget/$PACKAGE_ID.$VERSION.nupkg" --api-key "$NUGET_API_KEY" --source https://api.nuget.org/v3/index.json --skip-duplicate
# Versioned paths never change. A file already uploaded with the same bytes is skipped, so a
# re-run is safe; one with other bytes stops the run.
- name: Upload the packages and receipts
shell: bash
run: |
set -euo pipefail
for file in packages/rock-*/*; do
name="packages/v$VERSION/${file#packages/}"
md5=$(openssl dgst -md5 -binary "$file" | base64)
# An MD5 is 16 bytes, so its base64 is 22 characters and "==".
[[ "$md5" =~ ^[A-Za-z0-9+/]{22}==$ ]] || { echo "::error::$file has no valid MD5 (got '$md5')."; exit 1; }
echo "$name MD5 $md5"
type=application/zip
[[ "$file" == *.json ]] && type=application/json
hosted=$(az storage blob show --auth-mode login --account-name "$ACCOUNT" -c "$CONTAINER" -n "$name" --query properties.contentSettings.contentMd5 -o tsv 2>/dev/null || true)
if [ -n "$hosted" ]; then
[ "$hosted" = "$md5" ] || { echo "::error::$name is already published with other bytes. Tag a new version."; exit 1; }
echo "Already published: $name"
continue
fi
az storage blob upload --auth-mode login --account-name "$ACCOUNT" -c "$CONTAINER" -n "$name" -f "$file" \
--content-type "$type" --content-md5 "$md5" --content-cache-control "public, max-age=31536000, immutable" \
--overwrite false --only-show-errors -o none
echo "Uploaded: $name"
done
# A stable release updates index.json, and index-prerelease.json to match it. A prerelease
# updates only index-prerelease.json: the stable index plus the prerelease (decision 129).
# Both are the signed index from "Sign the package index".
- name: Upload the package index
shell: bash
run: |
set -euo pipefail
targets="packages/index-prerelease.json"
[ "$PRERELEASE" = "true" ] || targets="$targets packages/index.json"
for name in $targets; do
az storage blob upload --auth-mode login --account-name "$ACCOUNT" -c "$CONTAINER" -n "$name" -f index/index.json \
--content-type application/json --content-cache-control "public, max-age=300" \
--overwrite true --only-show-errors -o none
echo "Uploaded: $name"
done
{
echo "### Published v$VERSION"
echo
echo '```json'
cat index/index.json
echo '```'
} >> "$GITHUB_STEP_SUMMARY"