Update build-f-droid-apk.yml #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build FDroid APK | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
tags: | |
- 'fdroid-v*.*.*' | |
paths-ignore: | |
- 'README.md' | |
- 'wiki/**' | |
- 'public/**' | |
- 'scripts/**' | |
- '.vscode' | |
- '.idea' | |
pull_request: | |
branches: | |
- master | |
- main | |
paths-ignore: | |
- 'README.md' | |
- 'wiki/**' | |
- 'public/**' | |
- '.scripts/**' | |
- '.vscode' | |
- '.idea' | |
jobs: | |
build: | |
name: Install and build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
cache: pnpm | |
- name: Set Up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'zulu' # See 'Supported distributions' for available options | |
java-version: '17' | |
- name: Setup Gradle # fix `incompatible version of Kotlin. The binary version of its metadata is 1.9.0, expected version is 1.7.1.` | |
uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-version: 8.0.1 # use the gradle version I saw on eas build's console, which might match the kotlin version? | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Initialize and Update Submodules | |
run: pnpm run init-submodules | |
## configure cash for gradle : will help to reduce build time | |
- name: Cache Gradle Wrapper and Dependencies | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Build by eject eas | |
run: npx expo prebuild -p android --clean | |
# - name: Remove prorietary bits (for fix f-droid) | |
# run: npx zx scripts/fit-f-droid.mjs | |
- name: Build apk | |
run: | | |
cd android | |
./gradlew -v | |
./gradlew assembleRelease -Pkotlin.jvm.target=17 --no-daemon | |
## sign generated apk | |
- name: Sign APK | |
id: sign_app | |
uses: r0adkll/sign-android-release@v1 | |
with: | |
releaseDirectory: android/app/build/outputs/apk/release | |
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }} | |
alias: ${{ secrets.ANDROID_ALIAS }} | |
keyStorePassword: ${{ secrets.ANDROID_KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }} | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
draft: true | |
generate_release_notes: true | |
files: android/app/build/outputs/apk/release/app-release-signed.apk | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |