Publish StoreWeb 2026-11-09 15:03:33
This commit is contained in:
1 parent
efe11c1611
commit
cf0834d312
23 files changed
+47
-2
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -13,7 +13,6 @@
|
||||
}
|
||||
],
|
||||
"configProperties": {
|
||||
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
|
||||
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -13,7 +13,6 @@
|
||||
}
|
||||
],
|
||||
"configProperties": {
|
||||
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
|
||||
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
|
||||
}
|
||||
}
|
||||
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
param(
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$Message = ("Publish StoreWeb " + (Get-Date -Format 'yyyy-MM-dd HH:mm:ss'))
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
function Invoke-Git {
|
||||
& git @args
|
||||
if ($LASTEXITCODE -ne 0) { throw "Git command failed: git $($args[0])" }
|
||||
}
|
||||
|
||||
Push-Location -LiteralPath $PSScriptRoot
|
||||
try {
|
||||
if (!(Test-Path -LiteralPath .git) -or (Invoke-Git branch --show-current) -ne 'main') {
|
||||
throw 'Run this script from the StoreWeb publish repository on main.'
|
||||
}
|
||||
foreach ($file in '.gitignore', 'Store.Api', 'Store.Api.dll', 'Store.Api.deps.json', 'Store.Api.runtimeconfig.json') {
|
||||
if (!(Test-Path -LiteralPath $file -PathType Leaf)) { throw "Incomplete publish directory: missing $file" }
|
||||
}
|
||||
|
||||
Invoke-Git add --all
|
||||
Invoke-Git update-index --chmod=+x Store.Api
|
||||
$configs = Invoke-Git ls-files -- 'appsettings.json' 'appsettings.*.json' '**/appsettings.json' '**/appsettings.*.json'
|
||||
$ignored = Invoke-Git ls-files --cached --ignored --exclude-standard
|
||||
if ($configs -or $ignored) { throw 'The index contains configuration or ignored files. Check git status before publishing.' }
|
||||
|
||||
& git diff --cached --quiet --exit-code
|
||||
switch ($LASTEXITCODE) {
|
||||
0 {
|
||||
if ((Invoke-Git rev-parse HEAD) -eq (Invoke-Git rev-parse origin/main)) {
|
||||
Write-Host 'No changes to publish.'
|
||||
return
|
||||
}
|
||||
}
|
||||
1 { Invoke-Git commit -m $Message }
|
||||
default { throw 'Cannot inspect staged changes.' }
|
||||
}
|
||||
|
||||
# A commit-based tag makes a failed push safe to retry.
|
||||
$tag = 'release-' + (Invoke-Git rev-parse --short=12 HEAD)
|
||||
Invoke-Git push --atomic origin main "HEAD:refs/tags/$tag"
|
||||
Write-Host "Published $tag"
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user