refs TG-4: added autoReleaswe
This commit is contained in:
Vendored
+36
-15
@@ -45,22 +45,43 @@ stage('Create Gitea Release and Upload ZIP') {
|
|||||||
|
|
||||||
steps {
|
steps {
|
||||||
withCredentials([string(credentialsId: 'Gitea_Credentials', variable: 'GITEA_TOKEN')]) {
|
withCredentials([string(credentialsId: 'Gitea_Credentials', variable: 'GITEA_TOKEN')]) {
|
||||||
|
writeFile file: 'gitea-release.ps1', text: '''
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
|
Compress-Archive -Path "dist\\windows\\*" -DestinationPath "dist\\windows-build.zip" -Force
|
||||||
|
|
||||||
|
$headers = @{
|
||||||
|
Authorization = "token $env:GITEA_TOKEN"
|
||||||
|
}
|
||||||
|
|
||||||
|
$body = @{
|
||||||
|
tag_name = "v$env:BUILD_NUMBER"
|
||||||
|
target_commitish = "main"
|
||||||
|
name = "Release v$env:BUILD_NUMBER"
|
||||||
|
body = "Jenkins build $env:BUILD_NUMBER"
|
||||||
|
draft = $false
|
||||||
|
prerelease = $false
|
||||||
|
} | ConvertTo-Json
|
||||||
|
|
||||||
|
$release = Invoke-RestMethod `
|
||||||
|
-Method Post `
|
||||||
|
-Uri "https://git.grigowashere.ru/api/v1/repos/Grigo/Testing/releases" `
|
||||||
|
-Headers $headers `
|
||||||
|
-ContentType "application/json" `
|
||||||
|
-Body $body
|
||||||
|
|
||||||
|
$uploadUrl = "https://git.grigowashere.ru/api/v1/repos/Grigo/Testing/releases/$($release.id)/assets?name=windows-build.zip"
|
||||||
|
|
||||||
|
Invoke-RestMethod `
|
||||||
|
-Method Post `
|
||||||
|
-Uri $uploadUrl `
|
||||||
|
-Headers $headers `
|
||||||
|
-InFile "dist\\windows-build.zip" `
|
||||||
|
-ContentType "application/zip"
|
||||||
|
'''
|
||||||
|
|
||||||
bat '''
|
bat '''
|
||||||
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
|
powershell -NoProfile -ExecutionPolicy Bypass -File gitea-release.ps1
|
||||||
"$ErrorActionPreference='Stop'; ^
|
|
||||||
Compress-Archive -Path dist\\windows\\* -DestinationPath dist\\windows-build.zip -Force; ^
|
|
||||||
$headers = @{ Authorization = 'token ' + $env:GITEA_TOKEN }; ^
|
|
||||||
$body = @{ ^
|
|
||||||
tag_name = 'v' + $env:BUILD_NUMBER; ^
|
|
||||||
target_commitish = 'main'; ^
|
|
||||||
name = 'Release v' + $env:BUILD_NUMBER; ^
|
|
||||||
body = 'Jenkins build ' + $env:BUILD_NUMBER; ^
|
|
||||||
draft = $false; ^
|
|
||||||
prerelease = $false ^
|
|
||||||
} | ConvertTo-Json; ^
|
|
||||||
$release = Invoke-RestMethod -Method Post -Uri 'https://git.grigowashere.ru/api/v1/repos/Grigo/Testing/releases' -Headers $headers -ContentType 'application/json' -Body $body; ^
|
|
||||||
$uploadUrl = 'https://git.grigowashere.ru/api/v1/repos/Grigo/Testing/releases/' + $release.id + '/assets?name=windows-build.zip'; ^
|
|
||||||
Invoke-RestMethod -Method Post -Uri $uploadUrl -Headers $headers -InFile 'dist\\windows-build.zip' -ContentType 'application/zip'"
|
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user