.forgejo/workflows/dotnet.yaml aktualisiert
Some checks failed
Dotnet Build / build (push) Failing after 1m55s
Some checks failed
Dotnet Build / build (push) Failing after 1m55s
This commit is contained in:
parent
3e2ed4b627
commit
d9981c025d
1 changed files with 19 additions and 4 deletions
|
@ -80,16 +80,31 @@ jobs:
|
|||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
PROJECT_VERSION: ${{ env.PROJECT_VERSION }}
|
||||
run: |
|
||||
$owner = "WeeXnes"
|
||||
$repo = "WeeXnesSuite"
|
||||
$tag = "$env:PROJECT_VERSION"
|
||||
$fileName = "currentRelease_$tag.zip"
|
||||
$filePath = "release/$fileName"
|
||||
$apiUrl = "https://git.weexnes.dev/api/v1/repos/WeeXnes/WeexnesSuite/releases/tags/$tag"
|
||||
|
||||
$release = Invoke-RestMethod -Uri $apiUrl -Headers @{ Authorization = "token $env:RELEASE_TOKEN" }
|
||||
$uploadUrl = $release.upload_url -replace "\{\?name,label\}", "?name=$fileName"
|
||||
# Get release info by tag to get release ID
|
||||
$releaseInfoUrl = "https://git.weexnes.dev/api/v1/repos/$owner/$repo/releases/tags/$tag"
|
||||
try {
|
||||
$release = Invoke-RestMethod -Uri $releaseInfoUrl -Headers @{ Authorization = "token $env:RELEASE_TOKEN" }
|
||||
$releaseId = $release.id
|
||||
Write-Host "Found release ID: $releaseId"
|
||||
} catch {
|
||||
Write-Error "Failed to find release with tag '$tag'. Make sure the release exists."
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Upload the asset to the release by ID
|
||||
$uploadUrl = "https://git.weexnes.dev/api/v1/repos/$owner/$repo/releases/$releaseId/assets?name=$fileName"
|
||||
Write-Host "Uploading asset to: $uploadUrl"
|
||||
|
||||
Invoke-RestMethod -Uri $uploadUrl `
|
||||
-Headers @{ Authorization = "token $env:RELEASE_TOKEN" } `
|
||||
-Method Post `
|
||||
-ContentType "application/zip" `
|
||||
-InFile $filePath
|
||||
|
||||
Write-Host "Upload complete."
|
Loading…
Add table
Reference in a new issue