refs TG-3: added autoReleaswe

This commit is contained in:
2026-05-03 17:20:05 +03:00
parent 232fb9b2e5
commit 9e832ce9fa
Vendored
+22 -17
View File
@@ -10,7 +10,6 @@ pipeline {
TAIGA_URL = 'https://taiga.grigowashere.ru' TAIGA_URL = 'https://taiga.grigowashere.ru'
GITEA_OWNER = 'Grigo' GITEA_OWNER = 'Grigo'
GITEA_REPO = 'TestingAndroidBuild' GITEA_REPO = 'TestingAndroidBuild'
} }
stages { stages {
@@ -35,14 +34,23 @@ pipeline {
withCredentials([string(credentialsId: 'Gitea_Credentials', variable: 'GITEA_TOKEN')]) { withCredentials([string(credentialsId: 'Gitea_Credentials', variable: 'GITEA_TOKEN')]) {
writeFile file: 'gitea-release.sh', text: ''' writeFile file: 'gitea-release.sh', text: '''
#!/bin/bash #!/bin/bash
apkPath="build/outputs/apk/debug/app-debug.apk" # Define the APK file path
apkPath="build/outputs/apk/debug/app-debug.apk"
headers="Authorization: token $GITEA_TOKEN" # Check if the APK exists
if [ ! -f "$apkPath" ]; then
echo "APK file does not exist at $apkPath"
exit 1
fi
# Create the release on Gitea echo "APK file exists: $apkPath"
release=$(curl -X POST "https://git.grigowashere.ru/api/v1/repos/$GITEA_OWNER/$GITEA_REPO/releases" \
headers="Authorization: token $GITEA_TOKEN"
# Create the release on Gitea
release=$(curl -X POST "https://git.grigowashere.ru/api/v1/repos/$GITEA_OWNER/$GITEA_REPO/releases" \
-H "$headers" \ -H "$headers" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{ -d '{
@@ -54,21 +62,21 @@ pipeline {
"prerelease": false "prerelease": false
}') }')
releaseId=$(echo $release | jq -r .id) releaseId=$(echo $release | jq -r .id)
# Form URL for uploading APK asset # Form URL for uploading APK asset
uploadUrl="https://git.grigowashere.ru/api/v1/repos/$GITEA_OWNER/$GITEA_REPO/releases/$releaseId/assets?name=app-debug.apk" uploadUrl="https://git.grigowashere.ru/api/v1/repos/$GITEA_OWNER/$GITEA_REPO/releases/$releaseId/assets?name=app-debug.apk"
# Upload APK file to Gitea # Upload APK file to Gitea
curl -X POST "$uploadUrl" \ curl -X POST "$uploadUrl" \
-H "$headers" \ -H "$headers" \
-F "attachment=@$apkPath;type=application/vnd.android.package-archive" -F "attachment=@$apkPath;type=application/vnd.android.package-archive"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "Gitea asset upload failed: $apkPath" echo "Gitea asset upload failed: $apkPath"
exit 1 exit 1
fi fi
''' '''
sh ''' sh '''
chmod +x gitea-release.sh chmod +x gitea-release.sh
@@ -77,8 +85,6 @@ pipeline {
} }
} }
} }
} }
post { post {
@@ -104,7 +110,6 @@ pipeline {
import json import json
import os import os
import urllib.request import urllib.request
import urllib.error
taiga_url = os.environ["TAIGA_URL"] taiga_url = os.environ["TAIGA_URL"]
project_id = os.environ["TAIGA_PROJECT_ID"] project_id = os.environ["TAIGA_PROJECT_ID"]