Filip Rojek e294961407
Some checks failed
Build and Release APK / release (push) Failing after 7s
Added jq dependency to CI workflow
2025-05-03 19:16:09 +02:00

59 lines
1.8 KiB
YAML

name: Build and Release APK
on:
push:
tags:
- "v*.*.*" # Runs only when a version tag is pushed
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install jq
run: sudo apt-get update && sudo apt-get install -y jq
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: "3.29.3"
- name: Install dependencies
run: flutter pub get
- name: Build APK
run: flutter build apk --release
- name: Create Gitea release
env:
TOKEN_GITEA: ${{ secrets.TOKEN_GITEA }}
TAG_NAME: ${{ github.ref_name }}
run: |
curl -X POST https://git.filiprojek.cz/api/v1/repos/fr/android_fuelstats/releases \
-H "Authorization: token $TOKEN_GITEA" \
-H "Content-Type: application/json" \
-d '{
"tag_name": "'"$TAG_NAME"'",
"name": "'"$TAG_NAME"'",
"body": "Automated release for version '"$TAG_NAME"'",
"draft": false,
"prerelease": false
}'
- name: Upload APK to release
env:
TOKEN_GITEA: ${{ secrets.TOKEN_GITEA }}
TAG_NAME: ${{ github.ref_name }}
run: |
# Get release ID
RELEASE_ID=$(curl -s -H "Authorization: token $TOKEN_GITEA" \
https://git.filiprojek.cz/api/v1/repos/fr/android_fuelstats/releases/tags/$TAG_NAME \
| jq -r '.id')
curl -X POST \
-H "Authorization: token $TOKEN_GITEA" \
-F "attachment=@build/app/outputs/flutter-apk/app-release.apk" \
https://git.filiprojek.cz/api/v1/repos/fr/android_fuelstats/releases/$RELEASE_ID/assets