refs TG-3: added autoReleaswe
This commit is contained in:
Vendored
+16
-8
@@ -28,7 +28,7 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stage('Create Gitea Release and Upload APK') {
|
stage('Create Gitea Release and Upload APK') {
|
||||||
steps {
|
steps {
|
||||||
unstash 'apk'
|
unstash 'apk'
|
||||||
|
|
||||||
@@ -36,10 +36,17 @@ pipeline {
|
|||||||
writeFile file: 'gitea-release.sh', text: '''
|
writeFile file: 'gitea-release.sh', text: '''
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Define the APK file path
|
# Задаем путь к APK файлу
|
||||||
apkPath="build/outputs/apk/debug/app-debug.apk"
|
apkPath="app-debug.apk"
|
||||||
|
|
||||||
# Check if the APK exists
|
# Получаем артефакт из Jenkins
|
||||||
|
JENKINS_URL="https://jenkins.grigowashere.ru"
|
||||||
|
JOB_NAME="TestingAndroid"
|
||||||
|
BUILD_NUMBER="$BUILD_NUMBER"
|
||||||
|
ARTIFACT_PATH="app/build/outputs/apk/debug/app-debug.apk"
|
||||||
|
curl -O "$JENKINS_URL/job/$JOB_NAME/$BUILD_NUMBER/artifact/$ARTIFACT_PATH"
|
||||||
|
|
||||||
|
# Проверяем, существует ли APK файл
|
||||||
if [ ! -f "$apkPath" ]; then
|
if [ ! -f "$apkPath" ]; then
|
||||||
echo "APK file does not exist at $apkPath"
|
echo "APK file does not exist at $apkPath"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -47,9 +54,10 @@ fi
|
|||||||
|
|
||||||
echo "APK file exists: $apkPath"
|
echo "APK file exists: $apkPath"
|
||||||
|
|
||||||
|
# Загружаем релиз на Gitea
|
||||||
headers="Authorization: token $GITEA_TOKEN"
|
headers="Authorization: token $GITEA_TOKEN"
|
||||||
|
|
||||||
# Create the release on Gitea
|
# Создаем релиз в Gitea
|
||||||
release=$(curl -X POST "https://git.grigowashere.ru/api/v1/repos/$GITEA_OWNER/$GITEA_REPO/releases" \
|
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" \
|
||||||
@@ -64,10 +72,10 @@ release=$(curl -X POST "https://git.grigowashere.ru/api/v1/repos/$GITEA_OWNER/$G
|
|||||||
|
|
||||||
releaseId=$(echo $release | jq -r .id)
|
releaseId=$(echo $release | jq -r .id)
|
||||||
|
|
||||||
# Form URL for uploading APK asset
|
# Формируем URL для загрузки APK
|
||||||
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
|
# Загружаем APK файл в 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"
|
||||||
@@ -84,7 +92,7 @@ fi
|
|||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
post {
|
post {
|
||||||
|
|||||||
Reference in New Issue
Block a user