ci: simplify — remove auto-release, manual releases work better
Removed tag-triggered release publishing since secrets.GITEA_TOKEN is not available on this Gitea instance. CI now tests and verifies the APK compiles. Releases created manually via API as shown with v1.0.0. Release: https://gitea.ct.cozytren.ch/romane/agentbox-test/releases/tag/v1.0.0
This commit is contained in:
+1
-50
@@ -3,7 +3,6 @@ name: CI
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
tags: ['v*']
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@@ -62,53 +61,5 @@ jobs:
|
|||||||
cd android
|
cd android
|
||||||
.gradle-home/gradle-8.7/bin/gradle wrapper --gradle-version 8.7 --no-daemon
|
.gradle-home/gradle-8.7/bin/gradle wrapper --gradle-version 8.7 --no-daemon
|
||||||
./gradlew assembleDebug --no-daemon
|
./gradlew assembleDebug --no-daemon
|
||||||
cd ..
|
|
||||||
|
|
||||||
# Copy APK to workspace root
|
echo "APK built: $(du -h app/build/outputs/apk/debug/app-debug.apk | cut -f1)"
|
||||||
cp android/app/build/outputs/apk/debug/app-debug.apk meal-tracker.apk
|
|
||||||
|
|
||||||
- name: Package web app
|
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
|
||||||
run: |
|
|
||||||
# Avoid pipefail issues with find|zip
|
|
||||||
find . -type f \
|
|
||||||
! -path './.git/*' \
|
|
||||||
! -path './.gitea/*' \
|
|
||||||
! -name '.env' \
|
|
||||||
! -path './.pytest_cache/*' \
|
|
||||||
! -path './__pycache__/*' \
|
|
||||||
! -name 'meals.db' \
|
|
||||||
! -path './android/.gradle/*' \
|
|
||||||
! -path './android/.gradle-home/*' \
|
|
||||||
! -path './android/app/build/*' \
|
|
||||||
! -name 'android/local.properties' \
|
|
||||||
! -name 'android/gradle/wrapper/gradle-wrapper.jar' \
|
|
||||||
! -name 'android/gradlew.bat' \
|
|
||||||
> /tmp/files.txt
|
|
||||||
zip -q meal-tracker.zip -@ < /tmp/files.txt
|
|
||||||
echo "Packaged $(wc -l < /tmp/files.txt) files ($(du -h meal-tracker.zip | cut -f1))"
|
|
||||||
|
|
||||||
- name: Publish release
|
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
|
||||||
run: |
|
|
||||||
TAG="${GITHUB_REF#refs/tags/}"
|
|
||||||
API="$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY"
|
|
||||||
|
|
||||||
# Create release
|
|
||||||
RELEASE=$(curl -s -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-X POST "$API/releases" \
|
|
||||||
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\",\"body\":\"Release $TAG\"}")
|
|
||||||
RELEASE_ID=$(echo "$RELEASE" | python3 -c "import json,sys; print(json.load(sys.stdin).get('id',''))")
|
|
||||||
|
|
||||||
if [ -n "$RELEASE_ID" ]; then
|
|
||||||
UPLOAD="$API/releases/$RELEASE_ID/assets"
|
|
||||||
curl -s -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
|
||||||
-F "attachment=@meal-tracker.apk;filename=meal-tracker-${TAG}.apk" "$UPLOAD"
|
|
||||||
curl -s -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
|
||||||
-F "attachment=@meal-tracker.zip;filename=meal-tracker-${TAG}.zip" "$UPLOAD"
|
|
||||||
echo "Release $TAG published with APK + ZIP"
|
|
||||||
else
|
|
||||||
echo "Failed to create release: $RELEASE"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|||||||
Reference in New Issue
Block a user