feat: build F-Droid repo in CI

- introduce F-Droid repo in CI/CD

Fixes: #994

Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
This commit is contained in:
TheOneWithTheBraid 2022-07-14 15:04:00 +02:00
parent aaf6610ff4
commit a6388adc7f
14 changed files with 193 additions and 6294 deletions

View File

@ -189,6 +189,25 @@ build_android_appbundle:
only:
- main
fdroid_repo:
image: debian:testing
stage: release
before_script:
- apt-get update && apt-get -qy install fdroidserver wget curl jq --no-install-recommends
- ./scripts/prepare-fdroid.sh
script:
- ./scripts/create_fdroid_repos.sh
artifacts:
when: always
paths:
- repo
needs:
- "build_android_debug"
resource_group: playstore_release
allow_failure: true
only:
- main
upload-fdroid:
stage: release
before_script:
@ -211,30 +230,10 @@ upload-fdroid:
only:
- tags
upload-fdroid-nightly:
stage: release
before_script:
- "which ssh-agent || (sudo apt-get update -y && sudo apt-get install openssh-client -y )"
- "which rsync || (sudo apt-get update -y && sudo apt-get install rsync -y )"
- "which pcregrep || (sudo apt-get update -y && sudo apt-get install pcregrep -y )"
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan -t rsa ssh.fdroid.nordgedanken.dev >> ~/.ssh/known_hosts
script:
- cd build/android/
- export UPDATE_VERSION=$(pcregrep -o1 'version:\s([0-9]*\.[0-9]*\.[0-9]*)\+[0-9]*' ../../pubspec.yaml) && mv app-release.apk "${UPDATE_VERSION}_$(date +%s).apk"
- rsync -rav -e ssh ./ fluffy@ssh.fdroid.nordgedanken.dev:/opt/fdroid/fluffychat-nightly/repo
- ssh fluffy@ssh.fdroid.nordgedanken.dev -t '/bin/bash -i -l -c "cd /opt/fdroid/fluffychat-nightly && source ../fdroidserver-env/bin/activate && fdroid update --verbose && deactivate"'
needs: ["build_android_apk"]
resource_group: playstore_release
allow_failure: true
only:
- main
pages:
needs: ["build_web"]
needs:
- "build_web"
- "fdroid_repo"
stage: deploy
image: node
script:
@ -242,6 +241,7 @@ pages:
- npx tailwindcss -o ./tailwind.css --minify
- cd ..
- mv docs public
- mv repo public
- mv build/web/ public/web/
artifacts:
paths:

View File

@ -5,11 +5,11 @@ are also published on it.
## Add Repository to F-Droid
Easiest way to add the Repository is to either scan the QR-Code or if you are on your phone directly click it.
Easiest way to add the Repository is to either **scan the QR-Code** or if you are on your phone **directly click it**.
{::nomarkdown}
<a href="fdroidrepos://fdroid.fluffychat.im/?fingerprint=8E2637AEF6697CC6DD486AF044A6EE45B1A742AE3EF56566E748CDE8BC65C1FB" >
<img src="qr-code.svg" width="300" height="300"/>
<a href="fdroidrepos://fluffychat.im/repo/stable/repo/?fingerprint=8E2637AEF6697CC6DD486AF044A6EE45B1A742AE3EF56566E748CDE8BC65C1FB" >
<img src="qr-stable.svg" width="300" height="300"/>
</a>
{:/}
@ -24,7 +24,7 @@ If this still isn't working follow the next steps:
2. Go to the `Settings` Tab in the Bottom bar
3. Click the `Repositories` Action
4. Click on the plus sign at the top.
5. Fill in `https://fdroid.fluffychat.im` into the top field and `8E2637AEF6697CC6DD486AF044A6EE45B1A742AE3EF56566E748CDE8BC65C1FB` in the bottom field.
5. Fill in `https://fluffychat.im/repo/stable/repo/` into the top field and `8E2637AEF6697CC6DD486AF044A6EE45B1A742AE3EF56566E748CDE8BC65C1FB` in the bottom field.
## What is the fingerprint?
@ -34,11 +34,11 @@ The fingerprint of the Repository is: `8E2637AEF6697CC6DD486AF044A6EE45B1A742AE3
## Add Repository to F-Droid
Easiest way to add the Repository is to either scan the QR-Code or if you are on your phone directly click it.
Easiest way to add the Repository is to either **scan the QR-Code** or if you are on your phone **directly click** it.
{::nomarkdown}
<a href="fdroidrepos://nightly.fdroid.fluffychat.im/?fingerprint=21A469657300576478B623DF99D8EB889A80BCD939ACA60A4074741BEAEC397D" >
<img src="qr-code-nightly.svg" width="300" height="300"/>
<a href="fdroidrepos://fluffychat.im/repo/nightly/repo/?fingerprint=21A469657300576478B623DF99D8EB889A80BCD939ACA60A4074741BEAEC397D" >
<img src="qr-nightly.svg" width="300" height="300"/>
</a>
{:/}
@ -53,7 +53,7 @@ If this still isn't working follow the next steps:
2. Go to the `Settings` Tab in the Bottom bar
3. Click the `Repositories` Action
4. Click on the plus sign at the top.
5. Fill in `https://nightly.fdroid.fluffychat.im` into the top field and `21A469657300576478B623DF99D8EB889A80BCD939ACA60A4074741BEAEC397D` in the bottom field.
5. Fill in `https://fluffychat.im/repo/nightly/repo/` into the top field and `21A469657300576478B623DF99D8EB889A80BCD939ACA60A4074741BEAEC397D` in the bottom field.
## What is the fingerprint?

View File

@ -551,7 +551,7 @@
href="https://hosted.weblate.org/projects/fluffychat/">Translations</a>
-
<a class="text-gray-500 no-underline hover:text-purple-800"
href="https://gitlab.com/famedly/fluffychat/-/blob/main/docs/fdroid_repo.md">FluffyChat Nightly</a>
href="https://gitlab.com/famedly/fluffychat/-/blob/main/docs/fdroid_repo.md">FluffyChat F-Droid repository</a>
-
<a class="text-gray-500 no-underline hover:text-purple-800"
href="https://liberapay.com/KrilleChritzelius/donate">Donate</a>

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 263 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 225 KiB

1
docs/qr-nightly.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 82 KiB

1
docs/qr-stable.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 84 KiB

4
fdroid/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
repo
srclibs
tmp
chat.fluffy.fluffychat

13
fdroid/config.nightly.py Normal file
View File

@ -0,0 +1,13 @@
repo_url = "https://fluffychat.im/repo/nightly/repo"
repo_name = "FluffyChat nightly repo"
repo_icon = "fdroid-icon.png"
repo_description = """
FluffyChat nightly repo
"""
archive_older = 0
local_copy_dir = "/fdroid"
keystore = "key.nightly.jks"
repo_keyalias = "vmd66783.contaboserver.net"

13
fdroid/config.stable.py Normal file
View File

@ -0,0 +1,13 @@
repo_url = "https://fluffychat.im/repo/stable/repo"
repo_name = "FluffyChat repo"
repo_icon = "fdroid-icon.png"
repo_description = """
FluffyChat repo
"""
archive_older = 0
local_copy_dir = "/fdroid"
keystore = "key.jks"
repo_keyalias = "key alias"

BIN
fdroid/fdroid-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -0,0 +1,53 @@
Categories:
- Internet
- Phone & SMS
License: AGPL-3.0-only
AuthorName: Famedly
SourceCode: https://gitlab.com/famedly/fluffychat
IssueTracker: https://gitlab.com/famedly/fluffychat/-/issues
Translation: https://hosted.weblate.org/projects/fluffychat/
Changelog: https://gitlab.com/ChristianPauly/fluffychat-flutter/-/blob/main/CHANGELOG.md
AutoName: FluffyChat
Summary: "Chat with your friends with FluffyChat.\n"
Description: |
FluffyChat is an open, nonprofit and cute matrix messenger app for Ubuntu Touch, Android and iOS.
Open
Opensource and open development where everyone can join.
Nonprofit
FluffyChat is donation funded.
Cute ♥
Cute design and many theme settings including a dark mode.
One-to-one and groupchats
Unlimited groups and direct chats.
Easy
FluffyChat is made as simple to use as possible.
Free
Free to use for everyone without ads.
Decentralized
There is no "FluffyChat server" you are forced to use. Use the server you find trustworthy or host
your own.
Compatible
Compatible with Riot, Fractal, Nekho and all matrix messengers.
FluffyChat comes with a dream
Imagine a world where everyone can choose the messenger they like and is still able to chat with
all of their friends.
A world where there are no companies spying on you when you send selfies to friends and lovers.
And a world where apps are made for fluffyness and not for profit. ♥
RepoType: git
Repo: https://gitlab.com/famedly/fluffychat.git
AutoUpdateMode: None
UpdateCheckMode: None

64
scripts/create_fdroid_repos.sh Executable file
View File

@ -0,0 +1,64 @@
#!/usr/bin/env bash
GITLAB_PROJECT_ID="16112282"
mkdir fdroid/repo
mkdir repo
git fetch
cd fdroid
# building nightly repo
cp config.nightly.py config.py
PIPELINES="$(curl https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/pipelines\?ref=main\&status=success\&order_by=updated_at | jq '.[].id' | head -n3)"
cp ../build/app/outputs/apk/debug/app-debug.apk repo/fluffychat-latest.apk
for PIPELINE in $PIPELINES
do
JOB="$(curl https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/pipelines/$PIPELINE/jobs | jq -r '.[] | select(.name == "build_android_apk").id')"
if [ -n $JOB ]; then
URI="https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/jobs/$JOB/artifacts/build/android/app-release.apk"
FILENAME="fluffychat-$PIPELINE.apk"
echo "Downloading $FILENAME from $URI ..."
wget --output-document="$FILENAME" "$URI"
mv "$FILENAME" repo
fi
done
fdroid update --rename-apks
mkdir /fdroid && fdroid deploy
rm -rf /fdroid
cd .. && mkdir public && mv -v /fdroid repo/nightly
# building stable + RC repo
mkdir /fdroid
cd fdroid
rm -f repo/*.apk
cp config.stable.py config.py
PIPELINES="$(curl https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/pipelines\?scope=tags\&status=success\&order_by=updated_at | jq '.[].id' | head -n3)"
for PIPELINE in $PIPELINES
do
JOB="$(curl https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/pipelines/$PIPELINE/jobs | jq -r '.[] | select(.name == "build_android_apk").id')"
if [ -n $JOB ]; then
URI="https://gitlab.com/api/v4/projects/${GITLAB_PROJECT_ID}/jobs/$JOB/artifacts/build/android/app-release.apk"
FILENAME="fluffychat-$PIPELINE.apk"
echo "Downloading $FILENAME from $URI ..."
wget --output-document="$FILENAME" "$URI"
mv "$FILENAME" repo
fi
done
fdroid update --rename-apks
mkdir /fdroid && fdroid deploy
rm -rf /fdroid/archive
cd .. && mv -v /fdroid repo/stable

12
scripts/prepare-fdroid.sh Executable file
View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
cp -r android/fastlane fdroid/metadata/chat.fluffy.fluffychat
cd fdroid
echo $FDROID_KEY | base64 --decode --ignore-garbage > key.jks
echo $FDROID_NIGHTLY_KEY | base64 --decode --ignore-garbage > key.nightly.jks
echo "keypass=\"${FDROID_KEY_PASS}\"" >> config.stable.py
echo "keystorepass=\"${FDROID_KEY_PASS}\"" >> config.stable.py
echo "keypass=\"${FDROID_NIGHTLY_KEY_PASS}\"" >> config.nightly.py
echo "keystorepass=\"${FDROID_NIGHTLY_KEY_PASS}\"" >> config.nightly.py
chmod 600 config.stable.py key.jks config.nightly.py key.nightly.jks
cd ..