plasmoid/.forgejo/workflows/release.yml
randogoth 92791d5901
All checks were successful
Release APK / build (push) Successful in 2m42s
ci: disable Gradle daemon reuse in release build
The shared runner host keeps Gradle daemons alive for up to 3 hours
and hands them to the next matching build regardless of which
project started them. A daemon warmed by an unrelated checkout (even
a local devbox test build) can serve this project's CI run next,
carrying over stale in-memory classpath state and producing
inconsistent "package android.app does not exist" failures.
Disabling the daemon for this one step keeps dependency/wrapper
caches shared while avoiding the live-process contamination.
2026-10-14 10:49:31 +03:00

63 lines
2.5 KiB
YAML

name: Release APK
on:
push:
tags: ["v*"]
jobs:
build:
runs-on: linux-x86_64
steps:
- uses: actions/checkout@v4
- name: Extract version
run: |
VERSION=$(grep '^version:' pubspec.yaml | sed 's/version: //')
echo "VERSION_CODE=$(echo "$VERSION" | grep -oP '(?<=\+)\d+')" >> $GITHUB_ENV
echo "VERSION_NAME=$(echo "$VERSION" | grep -oP '^[^+]+')" >> $GITHUB_ENV
- name: Decode keystore
run: |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > android/app/release.jks
echo "KEYSTORE_PATH=$GITHUB_WORKSPACE/android/app/release.jks" >> $GITHUB_ENV
- name: Build release APK
env:
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
# This host runs other projects' builds too, and Gradle daemons
# persist across them. A daemon warmed by a different checkout
# can serve this build next, carrying over stale classpath state.
# ~/.gradle/caches (dependency jars, wrapper dists) stays shared
# and warm; only the long-lived daemon process is avoided.
GRADLE_OPTS: -Dorg.gradle.daemon=false
run: |
env -u GITHUB_TOKEN -u GH_TOKEN -u JAVA_HOME \
devbox run -- flutter build apk --release
- name: Create release and upload APK
env:
FORGEJO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
APK="plasmoid-${{ env.VERSION_NAME }}.apk"
cp build/app/outputs/flutter-apk/app-release.apk "$APK"
BODY=$(python3 -c "
import json
print(json.dumps(open('fastlane/metadata/android/en-US/changelogs/${{ env.VERSION_CODE }}.txt').read().strip()))
")
RELEASE_ID=$(curl -sf -X POST \
-H "Authorization: token $FORGEJO_TOKEN" \
-H "Content-Type: application/json" \
"$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/releases" \
-d "{\"tag_name\":\"$GITHUB_REF_NAME\",\"name\":\"$GITHUB_REF_NAME\",\"body\":$BODY}" \
| python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')
curl -sf -X POST \
-H "Authorization: token $FORGEJO_TOKEN" \
-H "Content-Type: application/vnd.android.package-archive" \
"$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID/assets?name=$APK" \
--data-binary @"$APK"