Fix Gitea release asset publishing
This commit is contained in:
@@ -115,10 +115,25 @@ jobs:
|
||||
$apiBase = "${{ github.server_url }}/api/v1"
|
||||
$repo = "${{ github.repository }}"
|
||||
$tag = "${{ steps.artifacts.outputs.tag }}"
|
||||
$version = "${{ steps.artifacts.outputs.version }}"
|
||||
$setupName = "${{ steps.artifacts.outputs.setup_name }}"
|
||||
$rawBase = "${{ github.server_url }}/${{ github.repository }}/raw/branch/release-assets%2F$tag"
|
||||
$headers = @{
|
||||
Authorization = "token $env:GITEA_TOKEN"
|
||||
Accept = "application/json"
|
||||
}
|
||||
$releaseBody = @"
|
||||
OpenScreen Windows setup $tag
|
||||
|
||||
Setup EXE:
|
||||
$rawBase/$setupName
|
||||
|
||||
SHA256:
|
||||
$rawBase/$setupName.sha256
|
||||
|
||||
Auto-update feed:
|
||||
${{ github.server_url }}/${{ github.repository }}/raw/branch/release-assets%2Flatest/latest.yml
|
||||
"@
|
||||
|
||||
try {
|
||||
$release = Invoke-RestMethod `
|
||||
@@ -130,7 +145,7 @@ jobs:
|
||||
tag_name = $tag
|
||||
target_commitish = "${{ github.sha }}"
|
||||
name = $tag
|
||||
body = "OpenScreen Windows setup $tag"
|
||||
body = $releaseBody
|
||||
draft = $false
|
||||
prerelease = $false
|
||||
} | ConvertTo-Json
|
||||
@@ -143,8 +158,22 @@ jobs:
|
||||
-Body $body
|
||||
}
|
||||
|
||||
$updateBody = @{
|
||||
tag_name = $tag
|
||||
target_commitish = "${{ github.sha }}"
|
||||
name = "OpenScreen $version"
|
||||
body = $releaseBody
|
||||
draft = $false
|
||||
prerelease = $false
|
||||
} | ConvertTo-Json
|
||||
$release = Invoke-RestMethod `
|
||||
-Method Patch `
|
||||
-Uri "$apiBase/repos/$repo/releases/$($release.id)" `
|
||||
-Headers $headers `
|
||||
-ContentType "application/json" `
|
||||
-Body $updateBody
|
||||
|
||||
$assets = @(
|
||||
"${{ steps.artifacts.outputs.setup_path }}",
|
||||
"${{ steps.artifacts.outputs.blockmap_path }}",
|
||||
"${{ steps.artifacts.outputs.sha256_path }}",
|
||||
"${{ steps.artifacts.outputs.latest_path }}"
|
||||
@@ -161,11 +190,17 @@ jobs:
|
||||
}
|
||||
|
||||
$uploadUri = "$apiBase/repos/$repo/releases/$($release.id)/assets?name=$([uri]::EscapeDataString($assetName))"
|
||||
Invoke-RestMethod `
|
||||
-Method Post `
|
||||
-Uri $uploadUri `
|
||||
-Headers $headers `
|
||||
-Form @{ attachment = Get-Item -LiteralPath $assetPath } | Out-Null
|
||||
& curl.exe `
|
||||
-sS `
|
||||
-f `
|
||||
-X POST `
|
||||
-H "Authorization: token $env:GITEA_TOKEN" `
|
||||
-H "Accept: application/json" `
|
||||
-F "attachment=@$assetPath" `
|
||||
$uploadUri | Out-Null
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
throw "Failed to upload release asset: $assetName"
|
||||
}
|
||||
}
|
||||
|
||||
- name: Publish generic updater branch
|
||||
|
||||
Reference in New Issue
Block a user