refs TG-4: added autoReleaswe

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