Fix error
This commit is contained in:
@@ -7,7 +7,8 @@ param(
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$GiteaUrl = $GiteaUrl.TrimEnd('/')$TargetDir = "C:\Apps\mini-pc-setup"
|
||||
$GiteaUrl = $GiteaUrl.TrimEnd('/')
|
||||
$TargetDir = "C:\Apps\mini-pc-setup"
|
||||
$TempZip = "$env:TEMP\mini-pc-setup-release.zip"
|
||||
$TempExtract = "$env:TEMP\mini-pc-release-extract"
|
||||
|
||||
@@ -29,7 +30,7 @@ if ($null -eq$ReleaseJson) {
|
||||
$TagName = $ReleaseJson.tag_name
|
||||
Write-Host "[INFO] Latest Release Tag: $TagName ($($ReleaseJson.name))" -ForegroundColor Green
|
||||
|
||||
$ZipAsset = $ReleaseJson.assets \vert{} Where-Object {$_.name -like "*.zip" } | Select-Object -First 1
|
||||
$ZipAsset = $ReleaseJson.assets | Where-Object { $_.name -like "*.zip" } | Select-Object -First 1
|
||||
if ($null -ne $ZipAsset) {
|
||||
$DownloadUrl = $ZipAsset.browser_download_url
|
||||
Write-Host "[1/3] Downloading attached release asset: $($ZipAsset.name)..."
|
||||
|
||||
+1
-20
@@ -24,26 +24,7 @@ echo ===========================================================================
|
||||
echo Repository : %GITEA_URL%/%REPO_OWNER%/%REPO_NAME%
|
||||
echo.
|
||||
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
|
||||
"$ErrorActionPreference = 'Stop';" ^
|
||||
"$base = '%GITEA_URL%'.TrimEnd('/'); $owner = '\%REPO_OWNER\%';$repo = '%REPO_NAME%';" ^
|
||||
"$apiUrl = \"$base/api/v1/repos/$owner/$repo/releases/latest\";" ^
|
||||
"$cred =$null;" ^
|
||||
"try {" ^
|
||||
" $rel = Invoke-RestMethod -Uri$apiUrl -UseBasicParsing;" ^
|
||||
"} catch {" ^
|
||||
" Write-Host '[AUTH] Private repository detected. Please sign in to Gitea:' -ForegroundColor Yellow;" ^
|
||||
" $cred = Get-Credential -Message 'Enter Gitea Credentials';" ^
|
||||
" $rel = Invoke-RestMethod -Uri $apiUrl -Credential$cred -UseBasicParsing;" ^
|
||||
"}" ^
|
||||
"$tag =$rel.tag_name;" ^
|
||||
"$rawUrl = \"$base/$owner/$repo/raw/tag/$tag/scripts/bootstrap.ps1\";" ^
|
||||
"if ($null -ne$cred) {" ^
|
||||
" $script = Invoke-RestMethod -Uri $rawUrl -Credential$cred -UseBasicParsing;" ^
|
||||
"} else {" ^
|
||||
" $script = Invoke-RestMethod -Uri$rawUrl -UseBasicParsing;" ^
|
||||
"}" ^
|
||||
"& ([scriptblock]::Create($script)) -GiteaUrl$base -Owner $owner -Repo$repo -ReleaseJson $rel -Credential$cred"
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -Command "$ErrorActionPreference='Stop'; $base='%GITEA_URL%'.TrimEnd('/'); $owner='%REPO_OWNER%'; $repo='%REPO_NAME%'; $apiUrl=\"$base/api/v1/repos/$owner/$repo/releases/latest\"; $cred=$null; try { $rel=Invoke-RestMethod -Uri $apiUrl -UseBasicParsing } catch { Write-Host '[AUTH] Private repository detected. Please sign in to Gitea:' -ForegroundColor Yellow; $cred=Get-Credential -Message 'Enter Gitea Credentials'; $rel=Invoke-RestMethod -Uri $apiUrl -Credential $cred -UseBasicParsing }; $tag=$rel.tag_name; $rawUrl=\"$base/$owner/$repo/raw/tag/$tag/scripts/bootstrap.ps1\"; if ($null -ne $cred) { $script=Invoke-RestMethod -Uri $rawUrl -Credential $cred -UseBasicParsing } else { $script=Invoke-RestMethod -Uri $rawUrl -UseBasicParsing }; & ([scriptblock]::Create($script)) -GiteaUrl $base -Owner $owner -Repo $repo -ReleaseJson $rel -Credential $cred"
|
||||
|
||||
if %errorLevel% neq 0 (
|
||||
echo.
|
||||
|
||||
Reference in New Issue
Block a user