Skip to content

Build Latest Release #509

Build Latest Release

Build Latest Release #509

name: Build Latest Release
on:
workflow_run:
workflows: ["Android Build Check"]
types: [completed]
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: latest-release
cancel-in-progress: true
jobs:
build-gms:
name: Build GMS Release APK
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Patch node_modules for reproducible builds
run: |
sed -i 's/getHostIpAddress(),/project.properties["reactNativeDevServerIp"]?.toString() ?: "localhost",/' \
node_modules/@react-native/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt
sed -i '/^project(rnscreens)/a add_link_options(-Wl,--build-id=none)' \
node_modules/react-native-screens/android/CMakeLists.txt
- name: Append signing config to gradle.properties
run: |
cat <<EOF >> apps/mobile/android/gradle.properties
MYAPP_UPLOAD_STORE_FILE=release.keystore
MYAPP_UPLOAD_STORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }}
MYAPP_UPLOAD_KEY_ALIAS=${{ secrets.KEY_ALIAS }}
MYAPP_UPLOAD_KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}
EOF
- name: Decode keystore
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
run: echo $KEYSTORE_BASE64 | base64 -d > apps/mobile/android/app/release.keystore
- name: Validate signing inputs
run: |
test -f apps/mobile/android/app/release.keystore || (echo "Keystore missing" && exit 1)
test -n "${{ secrets.KEYSTORE_PASSWORD }}" || exit 1
test -n "${{ secrets.KEY_ALIAS }}" || exit 1
test -n "${{ secrets.KEY_PASSWORD }}" || exit 1
- name: Build GMS Release APKs
run: |
cd apps/mobile/android
chmod +x gradlew
./gradlew assembleGmsRelease --no-daemon
- name: Upload GMS APKs
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: gms-release-apks
path: apps/mobile/android/app/build/outputs/apk/gms/release/*.apk
- name: Secure Cleanup
if: always()
run: |
rm -f apps/mobile/android/app/release.keystore
rm -f apps/mobile/android/gradle.properties
build-foss:
name: Build FOSS Release APK
if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
- name: Setup build environment
uses: ./.github/actions/setup-build
- name: Patch node_modules for reproducible builds
run: |
sed -i 's/getHostIpAddress(),/project.properties["reactNativeDevServerIp"]?.toString() ?: "localhost",/' \
node_modules/@react-native/gradle-plugin/react-native-gradle-plugin/src/main/kotlin/com/facebook/react/utils/AgpConfiguratorUtils.kt
sed -i '/^project(rnscreens)/a add_link_options(-Wl,--build-id=none)' \
node_modules/react-native-screens/android/CMakeLists.txt
- name: Append signing config to gradle.properties
run: |
cat <<EOF >> apps/mobile/android/gradle.properties
MYAPP_UPLOAD_STORE_FILE=release.keystore
MYAPP_UPLOAD_STORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }}
MYAPP_UPLOAD_KEY_ALIAS=${{ secrets.KEY_ALIAS }}
MYAPP_UPLOAD_KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}
EOF
- name: Decode keystore
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
run: echo $KEYSTORE_BASE64 | base64 -d > apps/mobile/android/app/release.keystore
- name: Validate signing inputs
run: |
test -f apps/mobile/android/app/release.keystore || (echo "Keystore missing" && exit 1)
test -n "${{ secrets.KEYSTORE_PASSWORD }}" || exit 1
test -n "${{ secrets.KEY_ALIAS }}" || exit 1
test -n "${{ secrets.KEY_PASSWORD }}" || exit 1
- name: Build FOSS Release APKs
run: |
cd apps/mobile/android
chmod +x gradlew
./gradlew assembleFossRelease --no-daemon
- name: Upload FOSS APKs
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: foss-release-apks
path: apps/mobile/android/app/build/outputs/apk/foss/release/*.apk
- name: Secure Cleanup
if: always()
run: |
rm -f apps/mobile/android/app/release.keystore
rm -f apps/mobile/android/gradle.properties
release:
name: Publish Latest Release
needs: [build-gms, build-foss]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Update Latest Tag
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git tag -f latest
git push -f origin latest
- name: Download GMS APKs
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: gms-release-apks
path: apks/gms
- name: Download FOSS APKs
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: foss-release-apks
path: apks/foss
- name: Publish to GitHub Release
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3
with:
tag_name: latest
name: "Latest Development Build"
body: |
## Automated Build (Tests Passed)
Built from commit: `${{ github.sha }}`
### GMS (Google Play Services)
**app-gms-arm64-v8a-release.apk** - Modern 64-bit devices (recommended)
**app-gms-armeabi-v7a-release.apk** - Older 32-bit devices
### FOSS (F-Droid / no Google Play Services)
**app-foss-arm64-v8a-release.apk** - Modern 64-bit devices (recommended)
**app-foss-armeabi-v7a-release.apk** - Older 32-bit devices
draft: false
prerelease: true
files: |
apks/gms/*.apk
apks/foss/*.apk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}