fix:修正离线发布脚本兼容性
This commit is contained in:
@@ -190,6 +190,7 @@ jobs:
|
||||
"rm -rf `"`$target`"",
|
||||
"mkdir -p `"`$target`"",
|
||||
"tar -xzf `"`$archive`" -C `"`$target`"",
|
||||
"find `"`$target/deploy`" -maxdepth 1 -type f -name '*.sh' -exec chmod 755 {} +",
|
||||
"rm -f `"`$archive`""
|
||||
) -join "`n"
|
||||
|
||||
|
||||
@@ -11,6 +11,15 @@ param(
|
||||
$ErrorActionPreference = "Stop"
|
||||
Set-StrictMode -Version Latest
|
||||
|
||||
function Convert-FileToUtf8Lf {
|
||||
param([string]$Path)
|
||||
|
||||
$content = [System.IO.File]::ReadAllText($Path)
|
||||
$normalized = $content.Replace("`r`n", "`n")
|
||||
$utf8NoBom = [System.Text.UTF8Encoding]::new($false)
|
||||
[System.IO.File]::WriteAllText($Path, $normalized, $utf8NoBom)
|
||||
}
|
||||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
$releaseAbs = Join-Path $repoRoot $ReleaseDir
|
||||
$bundleAbs = Join-Path $repoRoot $BundleDir
|
||||
@@ -38,6 +47,17 @@ Copy-Item -LiteralPath (Join-Path $repoRoot "deploy\nginx\default.conf") -Destin
|
||||
Copy-Item -LiteralPath (Join-Path $repoRoot "deploy\certs\README.md") -Destination (Join-Path $releaseAbs "deploy\certs\README.md")
|
||||
Copy-Item -LiteralPath $PlanFile -Destination (Join-Path $releaseAbs "deploy\release-plan.env")
|
||||
|
||||
$shellScripts = @(
|
||||
(Join-Path $releaseAbs "deploy\docker-load.sh"),
|
||||
(Join-Path $releaseAbs "deploy\project-release.sh"),
|
||||
(Join-Path $releaseAbs "deploy\project-rollback.sh"),
|
||||
(Join-Path $releaseAbs "deploy\impact-rules.sh"),
|
||||
(Join-Path $releaseAbs "deploy\service-catalog.sh")
|
||||
)
|
||||
foreach ($scriptPath in $shellScripts) {
|
||||
Convert-FileToUtf8Lf -Path $scriptPath
|
||||
}
|
||||
|
||||
if (Test-Path -LiteralPath $bundleAbs) {
|
||||
$bundles = Get-ChildItem -LiteralPath $bundleAbs -Filter "*.tar" -File
|
||||
foreach ($bundle in $bundles) {
|
||||
|
||||
Reference in New Issue
Block a user