CI: gebaute MSI zusaetzlich als Gitea-Release-Asset spiegeln

Neuer Schritt in release.yml lädt die MSI nach dem GitHub-Release per Gitea-API
(Release per Tag holen/anlegen, gleichnamiges Asset ersetzen, hochladen).
Benoetigt GitHub-Secret GITEA_TOKEN; ohne Token ueberspringt sich der Schritt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-21 00:27:47 +02:00
co-authored by Claude Opus 4.8
parent 37ae32bb94
commit 30d605703b
+47
View File
@@ -107,3 +107,50 @@ jobs:
- `Microsoft.Graph.Authentication` Modul (wird beim ersten Start automatisch angeboten)
files: "IntuneManager-${{ steps.ver.outputs.TAG }}.msi"
generate_release_notes: false
- name: Mirror MSI to Gitea release
shell: pwsh
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
GITEA_BASE: https://git.wende.it/api/v1
GITEA_OWNER: marco
GITEA_REPO: Intune-Manager
TAG: ${{ steps.ver.outputs.TAG }}
MSI_NAME: ${{ steps.build.outputs.MSI_NAME }}
COMMIT_SHA: ${{ github.sha }}
run: |
if ([string]::IsNullOrWhiteSpace($env:GITEA_TOKEN)) {
Write-Host "::notice::GITEA_TOKEN nicht gesetzt — Gitea-Upload uebersprungen."
exit 0
}
$headers = @{ Authorization = "token $env:GITEA_TOKEN" }
$repoUrl = "$($env:GITEA_BASE)/repos/$($env:GITEA_OWNER)/$($env:GITEA_REPO)"
# Release per Tag suchen; sonst anlegen (Tag wird bei Bedarf am Commit erzeugt).
$rel = $null
try { $rel = Invoke-RestMethod -Headers $headers -Uri "$repoUrl/releases/tags/$($env:TAG)" -Method GET } catch { $rel = $null }
if (-not $rel) {
$body = @{
tag_name = $env:TAG
target_commitish = $env:COMMIT_SHA
name = "Intune Manager $($env:TAG)"
body = "Automatisch aus der GitHub-CI gespiegelt."
} | ConvertTo-Json
$rel = Invoke-RestMethod -Headers $headers -Uri "$repoUrl/releases" -Method POST -ContentType 'application/json' -Body $body
}
$relId = $rel.id
# Vorhandenes Asset gleichen Namens entfernen (idempotent bei Re-Runs).
try {
$assets = Invoke-RestMethod -Headers $headers -Uri "$repoUrl/releases/$relId/assets" -Method GET
foreach ($a in @($assets)) {
if ($a.name -eq $env:MSI_NAME) {
Invoke-RestMethod -Headers $headers -Uri "$repoUrl/releases/$relId/assets/$($a.id)" -Method DELETE | Out-Null
}
}
} catch {}
# MSI als Attachment hochladen (multipart, Feldname 'attachment').
$assetUri = "$repoUrl/releases/$relId/assets?name=$([uri]::EscapeDataString($env:MSI_NAME))"
Invoke-RestMethod -Headers $headers -Uri $assetUri -Method POST -Form @{ attachment = Get-Item -LiteralPath $env:MSI_NAME } | Out-Null
Write-Host "MSI '$($env:MSI_NAME)' -> Gitea-Release '$($env:TAG)' hochgeladen."