refs TG-4: added autoReleaswe
This commit is contained in:
Vendored
+18
-23
@@ -40,33 +40,28 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Create Gitea Release') {
|
stage('Create Gitea Release and Upload ZIP') {
|
||||||
agent { label 'windows' }
|
agent { label 'windows' }
|
||||||
|
|
||||||
steps {
|
steps {
|
||||||
withCredentials([string(credentialsId: 'Gitea_Credentials', variable: 'GITEA_TOKEN')]) {
|
withCredentials([string(credentialsId: 'Gitea_Credentials', variable: 'GITEA_TOKEN')]) {
|
||||||
bat """
|
bat '''
|
||||||
curl -X POST "https://git.grigowashere.ru/api/v1/repos/Grigo/Testing/releases" ^
|
powershell -NoProfile -ExecutionPolicy Bypass -Command ^
|
||||||
-H "Authorization: token %GITEA_TOKEN%" ^
|
"$ErrorActionPreference='Stop'; ^
|
||||||
-H "Content-Type: application/json" ^
|
Compress-Archive -Path dist\\windows\\* -DestinationPath dist\\windows-build.zip -Force; ^
|
||||||
-d "{\\"tag_name\\":\\"v%BUILD_NUMBER%\\",\\"target_commitish\\":\\"main\\",\\"name\\":\\"Release v%BUILD_NUMBER%\\",\\"body\\":\\"Jenkins build %BUILD_NUMBER%\\",\\"draft\\":false,\\"prerelease\\":false}"
|
$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; ^
|
||||||
stage('Upload Artifact to Gitea Release') {
|
draft = $false; ^
|
||||||
agent { label 'windows' }
|
prerelease = $false ^
|
||||||
|
} | ConvertTo-Json; ^
|
||||||
steps {
|
$release = Invoke-RestMethod -Method Post -Uri 'https://git.grigowashere.ru/api/v1/repos/Grigo/Testing/releases' -Headers $headers -ContentType 'application/json' -Body $body; ^
|
||||||
withCredentials([string(credentialsId: 'Gitea_Credentials', variable: 'GITEA_TOKEN')]) {
|
$uploadUrl = 'https://git.grigowashere.ru/api/v1/repos/Grigo/Testing/releases/' + $release.id + '/assets?name=windows-build.zip'; ^
|
||||||
bat """
|
Invoke-RestMethod -Method Post -Uri $uploadUrl -Headers $headers -InFile 'dist\\windows-build.zip' -ContentType 'application/zip'"
|
||||||
powershell -NoProfile -Command "Compress-Archive -Path dist\\windows\\* -DestinationPath dist\\windows-build.zip -Force"
|
'''
|
||||||
|
|
||||||
curl -X POST "https://git.grigowashere.ru/api/v1/repos/Grigo/Testing/releases/tags/v%BUILD_NUMBER%/assets" ^
|
|
||||||
-H "Authorization: token %GITEA_TOKEN%" ^
|
|
||||||
-F "attachment=@dist\\windows-build.zip"
|
|
||||||
"""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user