Build APK / build (push) Failing after 2m17s
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
45 lines
2.4 KiB
YAML
45 lines
2.4 KiB
YAML
name: Build APK
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch: {}
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ghcr.io/cirruslabs/flutter:3.24.5
|
|
steps:
|
|
- name: Build signed APK + release
|
|
run: |
|
|
set -e
|
|
RUN="${{ github.run_number }}"
|
|
NAME="1.0.${RUN}"
|
|
TAG="v1.0.${RUN}"
|
|
API="${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
|
AUTH="Authorization: token ${{ secrets.GITHUB_TOKEN }}"
|
|
git config --global --add safe.directory '*'
|
|
git clone --depth 1 -b main "${{ github.server_url }}/${{ github.repository }}.git" src
|
|
cd src
|
|
echo "${{ secrets.ANDROID_KEYSTORE_B64 }}" | base64 -d > gamemanager.keystore
|
|
export KSPW="${{ secrets.ANDROID_KEYSTORE_PASSWORD }}"
|
|
export ALIAS="${{ secrets.ANDROID_KEY_ALIAS }}"
|
|
export KEYSTORE_PATH="$(pwd)/gamemanager.keystore"
|
|
flutter create --platforms=android --org nfteam --project-name gamemanager .
|
|
python3 tool/patch_android.py
|
|
flutter pub get
|
|
flutter build apk --release --build-name="${NAME}" --build-number="${RUN}"
|
|
cp build/app/outputs/flutter-apk/app-release.apk gamemanager.apk
|
|
printf '{"version":"1.0.%s","version_code":%s,"notes":"Build CI #%s"}' "${RUN}" "${RUN}" "${RUN}" > version.json
|
|
REL=$(curl -s -X POST "${API}/releases" -H "${AUTH}" -H 'Content-Type: application/json' -d "{\"tag_name\":\"${TAG}\",\"name\":\"GameManager ${TAG}\",\"target_commitish\":\"main\"}")
|
|
ID=$(echo "${REL}" | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
|
|
curl -s -X POST "${API}/releases/${ID}/assets?name=gamemanager.apk" -H "${AUTH}" -F "attachment=@gamemanager.apk;type=application/vnd.android.package-archive" >/dev/null
|
|
curl -s -X POST "${API}/releases/${ID}/assets?name=version.json" -H "${AUTH}" -F "attachment=@version.json;type=application/json" >/dev/null
|
|
echo "Release ${TAG} publiee"
|
|
|
|
- name: Notify ntfy
|
|
if: always()
|
|
run: |
|
|
if [ "${{ job.status }}" = "success" ]; then E="white_check_mark"; P="default"; else E="rotating_light"; P="high"; fi
|
|
curl -s -H "Authorization: Bearer ${{ secrets.NTFY_TOKEN }}" -H "Title: gamemanager APK - ${{ job.status }}" -H "Priority: ${P}" -H "Tags: ${E}" -d "Build APK #${{ github.run_number }} : ${{ job.status }}" "${{ secrets.NTFY_URL }}/${{ secrets.NTFY_TOPIC }}" || true
|