refs TG-4: added autoReleaswe
This commit is contained in:
Vendored
+24
-35
@@ -40,47 +40,36 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Upload Artifacts to Gitea') {
|
stage('Create Gitea Release') {
|
||||||
steps {
|
agent { label 'windows' }
|
||||||
script {
|
|
||||||
withCredentials([string(credentialsId: 'Gitea_Credentials', variable: 'Gitea_Credentials')]) {
|
|
||||||
def releaseUrl = "https://git.grigowashere.ru/api/v1/repos/username/repo/releases"
|
|
||||||
def json = """{
|
|
||||||
"tag_name": "v${BUILD_NUMBER}",
|
|
||||||
"target_commitish": "main",
|
|
||||||
"name": "Release v${BUILD_NUMBER}",
|
|
||||||
"body": "Release notes for v${BUILD_NUMBER}",
|
|
||||||
"draft": false,
|
|
||||||
"prerelease": false
|
|
||||||
}"""
|
|
||||||
sh """
|
|
||||||
curl -X POST ${releaseUrl} -H 'Authorization: token ${Gitea_Credentials}' -d '${json}'
|
|
||||||
if [ \$? -ne 0 ]; then
|
|
||||||
echo 'Error creating release'
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
stage('Upload Artifacts to Gitea Release') {
|
|
||||||
steps {
|
steps {
|
||||||
script {
|
withCredentials([string(credentialsId: 'GITEA_TOKEN', variable: 'GITEA_TOKEN')]) {
|
||||||
withCredentials([string(credentialsId: 'Gitea_Credentials', variable: 'Gitea_Credentials')]) {
|
bat """
|
||||||
def releaseUploadUrl = "https://git.grigowashere.ru/api/v1/repos/username/repo/releases/tags/v${BUILD_NUMBER}/assets"
|
curl -X POST "https://git.grigowashere.ru/api/v1/repos/Grigo/Testing/releases" ^
|
||||||
sh """
|
-H "Authorization: token %GITEA_TOKEN%" ^
|
||||||
curl -X POST ${releaseUploadUrl} -H 'Authorization: token ${Gitea_Credentials}' -F 'file=@dist/windows/test_app.exe'
|
-H "Content-Type: application/json" ^
|
||||||
if [ \$? -ne 0 ]; then
|
-d "{\\"tag_name\\":\\"v%BUILD_NUMBER%\\",\\"target_commitish\\":\\"main\\",\\"name\\":\\"Release v%BUILD_NUMBER%\\",\\"body\\":\\"Jenkins build %BUILD_NUMBER%\\",\\"draft\\":false,\\"prerelease\\":false}"
|
||||||
echo 'Error uploading artifact'
|
"""
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
"""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Upload Artifact to Gitea Release') {
|
||||||
|
agent { label 'windows' }
|
||||||
|
|
||||||
|
steps {
|
||||||
|
withCredentials([string(credentialsId: 'GITEA_TOKEN', variable: 'GITEA_TOKEN')]) {
|
||||||
|
bat """
|
||||||
|
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"
|
||||||
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
|
|||||||
Reference in New Issue
Block a user