Skip to content

Commit

Permalink
chore: try f-droid build
Browse files Browse the repository at this point in the history
  • Loading branch information
linonetwo committed Sep 16, 2023
1 parent 58cf5a5 commit d2e75c3
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 5 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/build-apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ jobs:
- name: Install dependencies
run: pnpm install

# - name: remove prorietary bits (for f-droid)
# run: npx zx scripts/fit-f-droid.mjs

## configure cash for gradle : will help to reduce build time
- name: Cache Gradle Wrapper
uses: actions/cache@v2
Expand Down
98 changes: 98 additions & 0 deletions .github/workflows/build-f-droid-apk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Build APK

on:
workflow_dispatch:
push:
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: '11'
- 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: Install dependencies
run: pnpm install

## configure cash for gradle : will help to reduce build time
- name: Cache Gradle Wrapper
uses: actions/cache@v2
with:
path: ~/.gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('android/gradle/wrapper/gradle-wrapper.properties') }}

- name: Cache Gradle Dependencies
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-caches-
- name: Build by eject eas
run: npx expo prebuild -p android --clean

- name: remove prorietary bits (for f-droid)
run: npx zx scripts/fit-f-droid.mjs

- name: Build apk
run: |
cd android/app
gradle assembleRelease --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 }}
10 changes: 8 additions & 2 deletions scripts/fit-f-droid.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import fs from 'fs-extra';
import path from 'path';

await Promise.all([fs.unlink('node_modules/expo-location'), fs.unlink('node_modules/expo-application')]);
await Promise.all([fs.copy('libs/expo-location', 'node_modules/expo-location'), fs.copy('libs/expo-application', 'node_modules/expo-application')]);
const projectRoot = path.join(__dirname, '..');

const expoLocationPath = path.join(projectRoot, 'node_modules', 'expo-location');
const expoApplicationPath = path.join(projectRoot, 'node_modules', 'expo-application');

await Promise.all([fs.unlink(expoLocationPath), fs.unlink(expoApplicationPath)]);
await Promise.all([fs.copy(path.join(projectRoot, 'libs', 'expo-location'), expoLocationPath), fs.copy(path.join(projectRoot, 'libs', 'expo-application'), expoApplicationPath)]);

0 comments on commit d2e75c3

Please sign in to comment.