fix: Use curl for file uploads and add UseBasicParsing flag for PowerShell 5.1 compatibility
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions
This commit is contained in:
parent
72b0cfb496
commit
1d26d785a3
1 changed files with 20 additions and 23 deletions
|
|
@ -113,6 +113,7 @@ try {
|
|||
-Headers $headers `
|
||||
-Body $releaseData `
|
||||
-TimeoutSec 30 `
|
||||
-UseBasicParsing `
|
||||
-ErrorAction Stop
|
||||
|
||||
$releaseInfo = $response.Content | ConvertFrom-Json
|
||||
|
|
@ -124,24 +125,23 @@ catch {
|
|||
exit 1
|
||||
}
|
||||
|
||||
# Step 2: Upload executable as asset
|
||||
# Step 2: Upload executable as asset using curl
|
||||
Write-Host "Uploading executable asset..." -ForegroundColor Yellow
|
||||
$uploadUrl = "$ForgejoUrl/api/v1/repos/$Repo/releases/$releaseId/assets"
|
||||
|
||||
try {
|
||||
$exeItem = Get-Item $ExePath
|
||||
$curlAuth = "$ForgejoUser`:$ForgejoPW"
|
||||
$uploadUrl = "$ForgejoUrl/api/v1/repos/$Repo/releases/$releaseId/assets"
|
||||
|
||||
$form = @{
|
||||
attachment = $exeItem
|
||||
$response = curl.exe -s -X POST `
|
||||
-u $curlAuth `
|
||||
-F "attachment=@$ExePath" `
|
||||
$uploadUrl
|
||||
|
||||
if ($response -like "*error*" -or $response -like "*404*") {
|
||||
Write-Host "ERROR uploading executable: $response" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
$response = Invoke-WebRequest -Uri $uploadUrl `
|
||||
-Method POST `
|
||||
-Headers @{ "Authorization" = "Basic $auth" } `
|
||||
-Form $form `
|
||||
-TimeoutSec 600 `
|
||||
-ErrorAction Stop
|
||||
|
||||
Write-Host "[OK] Executable uploaded" -ForegroundColor Green
|
||||
}
|
||||
catch {
|
||||
|
|
@ -149,23 +149,20 @@ catch {
|
|||
exit 1
|
||||
}
|
||||
|
||||
# Step 3: Upload checksum as asset
|
||||
# Step 3: Upload checksum as asset using curl
|
||||
Write-Host "Uploading checksum asset..." -ForegroundColor Yellow
|
||||
|
||||
try {
|
||||
$checksumItem = Get-Item $ChecksumPath
|
||||
$response = curl.exe -s -X POST `
|
||||
-u $curlAuth `
|
||||
-F "attachment=@$ChecksumPath" `
|
||||
$uploadUrl
|
||||
|
||||
$form = @{
|
||||
attachment = $checksumItem
|
||||
if ($response -like "*error*" -or $response -like "*404*") {
|
||||
Write-Host "ERROR uploading checksum: $response" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
$response = Invoke-WebRequest -Uri $uploadUrl `
|
||||
-Method POST `
|
||||
-Headers @{ "Authorization" = "Basic $auth" } `
|
||||
-Form $form `
|
||||
-TimeoutSec 30 `
|
||||
-ErrorAction Stop
|
||||
|
||||
Write-Host "[OK] Checksum uploaded" -ForegroundColor Green
|
||||
}
|
||||
catch {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue