refs TG-4: added autoReleaswe

This commit is contained in:
2026-05-03 11:57:27 +03:00
parent 69dbce3416
commit e95021c116
Vendored
+19 -30
View File
@@ -40,48 +40,37 @@ pipeline {
} }
} }
stage('Upload Artifacts to Gitea') { stage('Create Gitea Release') {
agent { label 'windows' }
steps { steps {
script { withCredentials([string(credentialsId: 'GITEA_TOKEN', variable: 'GITEA_TOKEN')]) {
withCredentials([string(credentialsId: 'Gitea_Credentials', variable: 'Gitea_Credentials')]) { bat """
def releaseUrl = "https://git.grigowashere.ru/api/v1/repos/username/repo/releases" curl -X POST "https://git.grigowashere.ru/api/v1/repos/Grigo/Testing/releases" ^
def json = """{ -H "Authorization: token %GITEA_TOKEN%" ^
"tag_name": "v${BUILD_NUMBER}", -H "Content-Type: application/json" ^
"target_commitish": "main", -d "{\\"tag_name\\":\\"v%BUILD_NUMBER%\\",\\"target_commitish\\":\\"main\\",\\"name\\":\\"Release v%BUILD_NUMBER%\\",\\"body\\":\\"Jenkins build %BUILD_NUMBER%\\",\\"draft\\":false,\\"prerelease\\":false}"
"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') { stage('Upload Artifact to Gitea Release') {
agent { label 'windows' }
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" powershell -NoProfile -Command "Compress-Archive -Path dist\\windows\\* -DestinationPath dist\\windows-build.zip -Force"
sh """
curl -X POST ${releaseUploadUrl} -H 'Authorization: token ${Gitea_Credentials}' -F 'file=@dist/windows/test_app.exe' curl -X POST "https://git.grigowashere.ru/api/v1/repos/Grigo/Testing/releases/tags/v%BUILD_NUMBER%/assets" ^
if [ \$? -ne 0 ]; then -H "Authorization: token %GITEA_TOKEN%" ^
echo 'Error uploading artifact' -F "attachment=@dist\\windows-build.zip"
exit 1
fi
""" """
} }
} }
} }
} }
}
post { post {
always { always {