A cross platform Audiobookshelf client for Android and iOS
Dart
Add GitHub Actions Android, APK-only, and all-platforms release workflows
Barnabas6759d7610976
diff --git a/.github/workflows/all-release.yml b/.github/workflows/all-release.ymlnew file mode 100644index 00000000..aee022a2--- /dev/null+++ b/.github/workflows/all-release.yml@@ -0,0 +1,231 @@+name: All Platforms Release++# Mirrors the `all-release` workflow in codemagic.yaml. Triggered manually via+# `gh workflow run all-release.yml` or the Actions UI. Builds the github-flavor+# APK, the playstore-flavor AAB, and the iOS IPA, uploads all three to the+# GitHub draft release, and pushes the IPA to TestFlight.+#+# Runs on macOS (needed for the iOS build); Java is installed for the Android+# build. Android signing uses the base64 keystore secret; iOS signing uses+# codemagic-cli-tools to fetch profiles via the App Store Connect API, exactly+# like ios-release.yml.++on:+ workflow_dispatch:+ inputs:+ beta_test_notes:+ description: "What to Test (TestFlight notes, optional)"+ required: false+ type: string+ beta_group:+ description: "TestFlight beta group (e.g. Early Absorbers)"+ required: false+ type: string+ default: ""++jobs:+ build:+ name: Build APK + AAB + IPA, publish to GitHub + TestFlight+ runs-on: macos-latest+ timeout-minutes: 120++ # Allow GITHUB_TOKEN to create/upload to GitHub Releases.+ permissions:+ contents: write++ env:+ BUNDLE_ID: com.barnabas.absorb+ APPLE_TEAM_ID: 3W9C9PWP64++ steps:+ - uses: actions/checkout@v4++ # Apple requires Xcode 26+ / iOS 26 SDK for App Store uploads. Pick the+ # newest Xcode installed on the runner.+ - name: Select latest Xcode+ run: |+ LATEST_XCODE=$(ls /Applications/ | grep -E '^Xcode_[0-9]+(\.[0-9]+)?(\.app)?$' | sort -V | tail -1)+ echo "Available Xcodes:"+ ls /Applications/ | grep -E '^Xcode' || true+ echo "Selecting: $LATEST_XCODE"+ sudo xcode-select -s "/Applications/$LATEST_XCODE/Contents/Developer"+ xcodebuild -version++ - uses: actions/setup-java@v4+ with:+ distribution: temurin+ java-version: "17"++ - uses: subosito/flutter-action@v2+ with:+ channel: stable+ cache: true++ - name: Read pubspec version+ id: version+ run: |+ RAW=$(grep '^version:' pubspec.yaml | sed 's/version: *//')+ VERSION_NAME="${RAW%%+*}"+ echo "raw=$RAW" >> "$GITHUB_OUTPUT"+ echo "tag=v$VERSION_NAME" >> "$GITHUB_OUTPUT"++ - name: Notify Discord (build started)+ if: env.DISCORD_WEBHOOK_URL != ''+ env:+ DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}+ VERSION: ${{ steps.version.outputs.raw }}+ RUN_URL: ${{ format('https://github.com/{0}/actions/runs/{1}', github.repository, github.run_id) }}+ run: |+ curl -sS -X POST "$DISCORD_WEBHOOK_URL" \+ -H "Content-Type: application/json" \+ -d "{\"embeds\":[{\"title\":\"Build started\",\"description\":\"**All Platforms Release** v$VERSION\\n[Build log]($RUN_URL)\",\"color\":3447003}]}" \+ > /dev/null 2>&1 || true++ # --- Android signing ---+ - name: Set up Android signing+ env:+ ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}+ ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}+ ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}+ ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}+ run: |+ echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/absorb-upload-key.jks"+ cat > android/key.properties <<EOF+ storePassword=$ANDROID_KEYSTORE_PASSWORD+ keyPassword=$ANDROID_KEY_PASSWORD+ keyAlias=$ANDROID_KEY_ALIAS+ storeFile=$RUNNER_TEMP/absorb-upload-key.jks+ EOF++ # --- iOS signing (mirrors ios-release.yml) ---+ - name: Install codemagic-cli-tools+ run: pipx install codemagic-cli-tools++ - name: Initialise temporary keychain+ env:+ KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}+ run: keychain initialize++ - name: Fetch signing files via App Store Connect API+ env:+ APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}+ APP_STORE_CONNECT_KEY_IDENTIFIER: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}+ APP_STORE_CONNECT_PRIVATE_KEY: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY }}+ CERTIFICATE_PRIVATE_KEY: ${{ secrets.CERTIFICATE_PRIVATE_KEY }}+ run: |+ # Fetch signing files for every bundle ID this project ships:+ # main app + NowPlayingWidget extension.+ for BID in "$BUNDLE_ID" "$BUNDLE_ID.NowPlayingWidget"; do+ app-store-connect fetch-signing-files "$BID" \+ --type IOS_APP_STORE \+ --create+ done+ keychain add-certificates++ # Mirror profiles into both possible Xcode lookup paths regardless+ # of where codemagic-cli-tools dropped them.+ NEW_DIR="$HOME/Library/Developer/Xcode/UserData/Provisioning Profiles"+ OLD_DIR="$HOME/Library/MobileDevice/Provisioning Profiles"+ mkdir -p "$NEW_DIR" "$OLD_DIR"+ while IFS= read -r p; do+ [ -z "$p" ] && continue+ cp -v "$p" "$NEW_DIR/" || true+ cp -v "$p" "$OLD_DIR/" || true+ done < <(find "$HOME" "$RUNNER_TEMP" "$GITHUB_WORKSPACE" /tmp -name '*.mobileprovision' 2>/dev/null)++ xcode-project use-profiles --project ios/Runner.xcodeproj++ # --- Builds ---+ - name: Build GitHub APK+ run: flutter build apk --release --flavor github --dart-define=GITHUB_BUILD=true++ - name: Build Play Store AAB+ run: flutter build appbundle --release --flavor playstore --dart-define=PLAYSTORE_BUILD=true++ - name: Build iOS IPA+ run: flutter build ipa --release --export-options-plist=$HOME/export_options.plist++ - name: Rename APK, AAB and IPA with version+ env:+ RAW: ${{ steps.version.outputs.raw }}+ run: |+ APK_SRC=$(ls build/app/outputs/apk/github/release/*.apk | head -1)+ mv "$APK_SRC" "build/app/outputs/apk/github/release/absorb-${RAW//+/-}.apk"+ AAB_SRC=$(ls build/app/outputs/bundle/playstoreRelease/*.aab | head -1)+ mv "$AAB_SRC" "build/app/outputs/bundle/playstoreRelease/absorb-${RAW}.aab"+ IPA_SRC=$(ls build/ios/ipa/*.ipa | head -1)+ mv "$IPA_SRC" "build/ios/ipa/absorb-${RAW}.ipa"++ - name: Upload all to GitHub draft release+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ VERSION_TAG: ${{ steps.version.outputs.tag }}+ run: |+ if gh release view "$VERSION_TAG" &>/dev/null; then+ gh release upload "$VERSION_TAG" \+ build/app/outputs/apk/github/release/*.apk \+ build/app/outputs/bundle/playstoreRelease/*.aab \+ build/ios/ipa/*.ipa \+ --clobber+ else+ gh release create "$VERSION_TAG" \+ build/app/outputs/apk/github/release/*.apk \+ build/app/outputs/bundle/playstoreRelease/*.aab \+ build/ios/ipa/*.ipa \+ --draft \+ --title "$VERSION_TAG"+ fi++ - name: Upload to TestFlight+ env:+ APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}+ APP_STORE_CONNECT_KEY_IDENTIFIER: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}+ APP_STORE_CONNECT_PRIVATE_KEY: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY }}+ run: |+ IPA_PATH=$(ls build/ios/ipa/*.ipa | head -1)+ app-store-connect publish --path "$IPA_PATH" --testflight++ # Notes + beta-group assignment happen after Apple processes the build.+ # They commonly fail with a timeout even when the upload itself worked,+ # so we run them in a separate best-effort step.+ - name: Add TestFlight notes / beta group (best-effort)+ if: inputs.beta_test_notes != '' || inputs.beta_group != ''+ continue-on-error: true+ env:+ APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}+ APP_STORE_CONNECT_KEY_IDENTIFIER: ${{ secrets.APP_STORE_CONNECT_KEY_ID }}+ APP_STORE_CONNECT_PRIVATE_KEY: ${{ secrets.APP_STORE_CONNECT_PRIVATE_KEY }}+ BETA_TEST_NOTES: ${{ inputs.beta_test_notes }}+ BETA_GROUP: ${{ inputs.beta_group }}+ run: |+ IPA_PATH=$(ls build/ios/ipa/*.ipa | head -1)+ ARGS=(--path "$IPA_PATH" --testflight --skip-package-upload)+ if [ -n "$BETA_TEST_NOTES" ]; then+ echo " + TestFlight notes ($(printf '%s' "$BETA_TEST_NOTES" | wc -c) chars)"+ ARGS+=(--whats-new "$BETA_TEST_NOTES" --locale en-US)+ fi+ if [ -n "$BETA_GROUP" ]; then+ echo " + Beta group: $BETA_GROUP"+ ARGS+=(--beta-group "$BETA_GROUP")+ fi+ app-store-connect publish "${ARGS[@]}"++ - name: Notify Discord (build finished)+ if: always() && env.DISCORD_WEBHOOK_URL != ''+ env:+ DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}+ VERSION: ${{ steps.version.outputs.raw }}+ RUN_URL: ${{ format('https://github.com/{0}/actions/runs/{1}', github.repository, github.run_id) }}+ STATUS: ${{ job.status }}+ run: |+ if [ "$STATUS" = "success" ]; then+ TITLE="Build successful"+ COLOR=3066993+ else+ TITLE="Build failed"+ COLOR=15158332+ fi+ curl -sS -X POST "$DISCORD_WEBHOOK_URL" \+ -H "Content-Type: application/json" \+ -d "{\"embeds\":[{\"title\":\"$TITLE\",\"description\":\"**All Platforms Release** v$VERSION\\n[Build log]($RUN_URL)\",\"color\":$COLOR}]}" \+ > /dev/null 2>&1 || truediff --git a/.github/workflows/android-release.yml b/.github/workflows/android-release.ymlnew file mode 100644index 00000000..90db69d4--- /dev/null+++ b/.github/workflows/android-release.yml@@ -0,0 +1,124 @@+name: Android Release++# Mirrors the `android-release` workflow in codemagic.yaml. Triggered manually+# via `gh workflow run android-release.yml` or the Actions UI. Builds the+# github-flavor APK and the playstore-flavor AAB, renames them with the pubspec+# version, and uploads both to the GitHub draft release for that version.+#+# Signing: GitHub Actions can't use Codemagic's managed keystore, so the upload+# keystore is stored as a base64 secret (ANDROID_KEYSTORE_BASE64) and decoded+# into a temp file at build time. See repo secrets for the password/alias values.++on:+ workflow_dispatch:++jobs:+ build:+ name: Build APK + AAB, publish to GitHub+ runs-on: ubuntu-latest+ timeout-minutes: 60++ # Allow GITHUB_TOKEN to create/upload to GitHub Releases.+ permissions:+ contents: write++ steps:+ - uses: actions/checkout@v4++ - uses: actions/setup-java@v4+ with:+ distribution: temurin+ java-version: "17"++ - uses: subosito/flutter-action@v2+ with:+ channel: stable+ cache: true++ - name: Read pubspec version+ id: version+ run: |+ RAW=$(grep '^version:' pubspec.yaml | sed 's/version: *//')+ VERSION_NAME="${RAW%%+*}"+ echo "raw=$RAW" >> "$GITHUB_OUTPUT"+ echo "tag=v$VERSION_NAME" >> "$GITHUB_OUTPUT"++ - name: Notify Discord (build started)+ if: env.DISCORD_WEBHOOK_URL != ''+ env:+ DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}+ VERSION: ${{ steps.version.outputs.raw }}+ RUN_URL: ${{ format('https://github.com/{0}/actions/runs/{1}', github.repository, github.run_id) }}+ run: |+ curl -sS -X POST "$DISCORD_WEBHOOK_URL" \+ -H "Content-Type: application/json" \+ -d "{\"embeds\":[{\"title\":\"Build started\",\"description\":\"**Android Release** v$VERSION\\n[Build log]($RUN_URL)\",\"color\":3447003}]}" \+ > /dev/null 2>&1 || true++ - name: Set up Android signing+ env:+ ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}+ ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}+ ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}+ ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}+ run: |+ echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/absorb-upload-key.jks"+ cat > android/key.properties <<EOF+ storePassword=$ANDROID_KEYSTORE_PASSWORD+ keyPassword=$ANDROID_KEY_PASSWORD+ keyAlias=$ANDROID_KEY_ALIAS+ storeFile=$RUNNER_TEMP/absorb-upload-key.jks+ EOF++ - name: Build GitHub APK+ run: flutter build apk --release --flavor github --dart-define=GITHUB_BUILD=true++ - name: Build Play Store AAB+ run: flutter build appbundle --release --flavor playstore --dart-define=PLAYSTORE_BUILD=true++ - name: Rename APK and AAB with version+ env:+ RAW: ${{ steps.version.outputs.raw }}+ run: |+ APK_SRC=$(ls build/app/outputs/apk/github/release/*.apk | head -1)+ mv "$APK_SRC" "build/app/outputs/apk/github/release/absorb-${RAW//+/-}.apk"+ AAB_SRC=$(ls build/app/outputs/bundle/playstoreRelease/*.aab | head -1)+ mv "$AAB_SRC" "build/app/outputs/bundle/playstoreRelease/absorb-${RAW}.aab"++ - name: Upload APK + AAB to GitHub draft release+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ VERSION_TAG: ${{ steps.version.outputs.tag }}+ run: |+ if gh release view "$VERSION_TAG" &>/dev/null; then+ gh release upload "$VERSION_TAG" \+ build/app/outputs/apk/github/release/*.apk \+ build/app/outputs/bundle/playstoreRelease/*.aab \+ --clobber+ else+ gh release create "$VERSION_TAG" \+ build/app/outputs/apk/github/release/*.apk \+ build/app/outputs/bundle/playstoreRelease/*.aab \+ --draft \+ --title "$VERSION_TAG"+ fi++ - name: Notify Discord (build finished)+ if: always() && env.DISCORD_WEBHOOK_URL != ''+ env:+ DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}+ VERSION: ${{ steps.version.outputs.raw }}+ RUN_URL: ${{ format('https://github.com/{0}/actions/runs/{1}', github.repository, github.run_id) }}+ STATUS: ${{ job.status }}+ run: |+ if [ "$STATUS" = "success" ]; then+ TITLE="Build successful"+ COLOR=3066993+ else+ TITLE="Build failed"+ COLOR=15158332+ fi+ curl -sS -X POST "$DISCORD_WEBHOOK_URL" \+ -H "Content-Type: application/json" \+ -d "{\"embeds\":[{\"title\":\"$TITLE\",\"description\":\"**Android Release** v$VERSION\\n[Build log]($RUN_URL)\",\"color\":$COLOR}]}" \+ > /dev/null 2>&1 || truediff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.ymlnew file mode 100644index 00000000..06134a7e--- /dev/null+++ b/.github/workflows/github-release.yml@@ -0,0 +1,116 @@+name: GitHub APK Only++# Mirrors the `github-release` workflow in codemagic.yaml. Triggered manually via+# `gh workflow run github-release.yml` or the Actions UI. Builds just the+# github-flavor APK, renames it with the pubspec version, and uploads it to the+# GitHub draft release for that version.+#+# Signing: the upload keystore is stored as a base64 secret+# (ANDROID_KEYSTORE_BASE64) and decoded into a temp file at build time.++on:+ workflow_dispatch:++jobs:+ build:+ name: Build APK, publish to GitHub+ runs-on: ubuntu-latest+ timeout-minutes: 60++ # Allow GITHUB_TOKEN to create/upload to GitHub Releases.+ permissions:+ contents: write++ steps:+ - uses: actions/checkout@v4++ - uses: actions/setup-java@v4+ with:+ distribution: temurin+ java-version: "17"++ - uses: subosito/flutter-action@v2+ with:+ channel: stable+ cache: true++ - name: Read pubspec version+ id: version+ run: |+ RAW=$(grep '^version:' pubspec.yaml | sed 's/version: *//')+ VERSION_NAME="${RAW%%+*}"+ echo "raw=$RAW" >> "$GITHUB_OUTPUT"+ echo "tag=v$VERSION_NAME" >> "$GITHUB_OUTPUT"++ - name: Notify Discord (build started)+ if: env.DISCORD_WEBHOOK_URL != ''+ env:+ DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}+ VERSION: ${{ steps.version.outputs.raw }}+ RUN_URL: ${{ format('https://github.com/{0}/actions/runs/{1}', github.repository, github.run_id) }}+ run: |+ curl -sS -X POST "$DISCORD_WEBHOOK_URL" \+ -H "Content-Type: application/json" \+ -d "{\"embeds\":[{\"title\":\"Build started\",\"description\":\"**GitHub APK Only** v$VERSION\\n[Build log]($RUN_URL)\",\"color\":3447003}]}" \+ > /dev/null 2>&1 || true++ - name: Set up Android signing+ env:+ ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}+ ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}+ ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}+ ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}+ run: |+ echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/absorb-upload-key.jks"+ cat > android/key.properties <<EOF+ storePassword=$ANDROID_KEYSTORE_PASSWORD+ keyPassword=$ANDROID_KEY_PASSWORD+ keyAlias=$ANDROID_KEY_ALIAS+ storeFile=$RUNNER_TEMP/absorb-upload-key.jks+ EOF++ - name: Build GitHub APK+ run: flutter build apk --release --flavor github --dart-define=GITHUB_BUILD=true++ - name: Rename APK with version+ env:+ RAW: ${{ steps.version.outputs.raw }}+ run: |+ APK_SRC=$(ls build/app/outputs/apk/github/release/*.apk | head -1)+ mv "$APK_SRC" "build/app/outputs/apk/github/release/absorb-${RAW//+/-}.apk"++ - name: Upload APK to GitHub draft release+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ VERSION_TAG: ${{ steps.version.outputs.tag }}+ run: |+ if gh release view "$VERSION_TAG" &>/dev/null; then+ gh release upload "$VERSION_TAG" \+ build/app/outputs/apk/github/release/*.apk \+ --clobber+ else+ gh release create "$VERSION_TAG" \+ build/app/outputs/apk/github/release/*.apk \+ --draft \+ --title "$VERSION_TAG"+ fi++ - name: Notify Discord (build finished)+ if: always() && env.DISCORD_WEBHOOK_URL != ''+ env:+ DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}+ VERSION: ${{ steps.version.outputs.raw }}+ RUN_URL: ${{ format('https://github.com/{0}/actions/runs/{1}', github.repository, github.run_id) }}+ STATUS: ${{ job.status }}+ run: |+ if [ "$STATUS" = "success" ]; then+ TITLE="Build successful"+ COLOR=3066993+ else+ TITLE="Build failed"+ COLOR=15158332+ fi+ curl -sS -X POST "$DISCORD_WEBHOOK_URL" \+ -H "Content-Type: application/json" \+ -d "{\"embeds\":[{\"title\":\"$TITLE\",\"description\":\"**GitHub APK Only** v$VERSION\\n[Build log]($RUN_URL)\",\"color\":$COLOR}]}" \+ > /dev/null 2>&1 || true