Skip to content

Commit ab03297

Browse files
MohitMaliDeveloperkelson42
authored andcommitted
Uploading the fdroid nightly on our server using fdroid server.
* Installing fdroid server in our CI and generating the metadata and other stuff required by the fdroid to fetch the nightly build. * Created the config-template.yml that is required by the fdroidserver.
1 parent b055478 commit ab03297

File tree

2 files changed

+67
-15
lines changed

2 files changed

+67
-15
lines changed
Lines changed: 56 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,77 @@
1-
name: Publish nightly build
1+
name: Publish fdroid nightly build
22

3+
# This workflow is triggered on a schedule or when specific tags are pushed.
4+
# It runs every Monday at 12:00 UTC and also when the 'fdroid_nightly' tag is pushed.
35
on:
4-
pull_request:
5-
branches:
6-
- testing
6+
push:
7+
tags:
8+
- 'fdroid_nightly' # fdroid_nightly Tag
9+
schedule:
10+
- cron: '0 12 * * 1' # Runs every Monday at 12:00
711

812
jobs:
913
nightly:
10-
name: Publish nightly build
14+
name: Publish fdroid nightly build
15+
permissions:
16+
contents: read
1117
runs-on: ubuntu-22.04
1218
environment: nightly
1319
steps:
1420
- name: Checkout
1521
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 1
1624

1725
- name: Set up JDK 17
1826
uses: actions/setup-java@v4
1927
with:
2028
java-version: 17
2129
distribution: temurin
2230

23-
- name: Build
31+
- name: Decrypt files
32+
env:
33+
KEYSTORE: ${{ secrets.keystore }}
34+
SSH_KEY: ${{ secrets.ssh_key }}
35+
run: |
36+
echo "$KEYSTORE" | base64 -d > kiwix-android.keystore
37+
echo "$SSH_KEY" | base64 -d > ssh_key
38+
chmod 600 ssh_key
39+
40+
- name: Build nightly APK
41+
env:
42+
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
43+
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
44+
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
45+
APK_BUILD: "true"
2446
run: |
25-
# use timestamp as Version Code
26-
export versionCode=$(date '+%s')
27-
sed -i "s,^\(\s*versionCode\) *[0-9].*,\1 $versionCode," app/build.gradle.kts
28-
./gradlew assembleDebug
47+
./gradlew assembleNightly
2948
30-
- name: fdroid nightly
49+
- name: Install F-Droid server and dependencies
3150
run: |
32-
sudo add-apt-repository ppa:fdroid/fdroidserver
51+
# Installing fdroidserver and androguard.
52+
# Note: fdroidserver from apt uses the system Python environment.
53+
# The old androguard (v3.4.0a1) from apt can't parse resources.arsc in Android 16 APKs,
54+
# so we install the latest androguard in the same environment via pip.
3355
sudo apt-get update
34-
sudo apt-get install apksigner fdroidserver --no-install-recommends
35-
export DEBUG_KEYSTORE=$\{\{ secrets.DEBUG_KEYSTORE \}\}
36-
fdroid nightly --archive-older 10
56+
sudo apt-get install -y python3 python3-pip
57+
python3 -m pip install --upgrade pip
58+
python3 -m pip install --upgrade fdroidserver androguard
59+
60+
- name: Prepare F-Droid repo
61+
env:
62+
UNIVERSAL_DEBUG_APK: app/build/outputs/apk/nightly/*universal*.apk
63+
KIWIX_ICON: app/src/main/kiwix_icon-web.png
64+
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
65+
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
66+
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
67+
run: |
68+
mkdir -p fdroid/repo/icons
69+
cp $UNIVERSAL_DEBUG_APK fdroid/repo/
70+
cp "$KIWIX_ICON" fdroid/repo/icons/icon.png
71+
envsubst < config-template.yml > fdroid/config.yml
72+
cd fdroid
73+
fdroid update --create-metadata
74+
75+
- name: release fdroid nightly to kiwix.download.org
76+
run: |
77+
scp -P 30022 -vrp -i ssh_key -o StrictHostKeyChecking=no fdroid [email protected]:/data/download/fdroid/

config-template.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
repo_url: https://download.kiwix.org/fdroid/repo
3+
repo_name: Kiwix repository for fdroid nightly.
4+
repo_description: |-
5+
This is a nightly server for fdroid nightly build.
6+
archive_older: 0
7+
repo_icon: icon.png
8+
repo_keyalias: ${KEY_ALIAS}
9+
keystorepass: ${KEY_STORE_PASSWORD}
10+
keypass: ${KEY_PASSWORD}
11+
keystore: ../kiwix-android.keystore

0 commit comments

Comments
 (0)