Publish release assets from tag workflow
All checks were successful
OfficeCom Sentinel Client / validate-client (push) Successful in 25s
OfficeCom Sentinel Client / build-client-windows (push) Has been skipped

This commit is contained in:
OfficeCom Codex
2026-07-25 03:08:12 +02:00
parent 3ea0baa147
commit 290033680b

View File

@@ -68,3 +68,30 @@ jobs:
artifacts/OCSentinelClient-win-x64.zip.sha256 artifacts/OCSentinelClient-win-x64.zip.sha256
artifacts/version.json artifacts/version.json
if-no-files-found: warn if-no-files-found: warn
- name: Publish Gitea release assets
if: startsWith(github.ref, 'refs/tags/v')
shell: pwsh
run: |
$headers = @{ Authorization = "token $env:GITEA_TOKEN" }
$repository = $env:GITEA_REPOSITORY
$baseUrl = "$env:GITEA_SERVER_URL/api/v1/repos/$repository"
$tag = "${{ github.ref_name }}"
$releaseBody = @{
tag_name = $tag
target_commitish = "${{ github.sha }}"
name = "OfficeCom Sentinel $tag"
body = "Automated OfficeCom Sentinel client release."
} | ConvertTo-Json
try {
$release = Invoke-RestMethod -Method Get -Headers $headers -Uri "$baseUrl/releases/tags/$tag"
}
catch {
$release = Invoke-RestMethod -Method Post -Headers $headers -ContentType "application/json" -Body $releaseBody -Uri "$baseUrl/releases"
}
foreach ($file in @("artifacts/OCSentinelClient-win-x64.zip", "artifacts/OCSentinelClient-win-x64.zip.sha256", "artifacts/version.json")) {
$assetName = [System.IO.Path]::GetFileName($file)
Invoke-RestMethod -Method Post -Headers $headers -InFile $file -ContentType "application/octet-stream" -Uri "$baseUrl/releases/$($release.id)/assets?name=$assetName" | Out-Null
}