gitlab-ci: nightly builds using `fdroid nightly`

This commit is contained in:
Hans-Christoph Steiner 2018-01-04 23:00:55 +01:00
parent a170b054dd
commit 0983a6a0b0
6 changed files with 5 additions and 116 deletions

2
.gitignore vendored
View File

@ -46,3 +46,5 @@ junit-report.xml
# Screen dumps from Android Studio/DDMS
captures/
/fdroid/

View File

@ -89,7 +89,9 @@ deploy_nightly:
only:
- master
script:
- "[ -z \"$DEBUG_KEYSTORE\" ] || ./config/nightly-repo/deploy"
- ./gradlew assembleDebug
- apt update; apt install -y --no-install-recommends fdroidserver python3-qrcode openssh-client
- fdroid nightly -v
after_script:
# this file changes every time but should not be cached

View File

@ -1,18 +0,0 @@
repo_icon = "fdroid-icon.png"
repo_description = """
This repo is nightly builds, it should only be used for testing!
"""
archive_older = 10
archive_icon = "fdroid-icon.png"
archive_description = """
The repository of older versions of applications from the main repository.
"""
make_current_version_link = False
accepted_formats = ('txt', 'yml')
repo_keyalias = "androiddebugkey"
keystorepass = "android"
keypass = "android"
keydname = "CN=Android Debug,O=Android,C=US"

View File

@ -1,82 +0,0 @@
#!/bin/bash
set -e
set -x
echo "deb http://deb.debian.org/debian stretch-backports main" \
> /etc/apt/sources.list.d/stretch-backports.list
apt-get update
apt-get install -y --no-install-recommends -t stretch-backports \
fdroidserver openssh-client rsync python3-qrcode
repo_git_base=${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}-nightly
repo_base=https://gitlab.com/${repo_git_base}
repo_url=${repo_base}/raw/master/fdroid/repo
archive_url=${repo_base}/raw/master/fdroid/archive
mkdir -p $HOME/.android
keystore=$HOME/.android/debug.keystore
echo "repo_name = '$repo_git_base'" >> config/nightly-repo/config.py
echo "repo_url = '$repo_url'" >> config/nightly-repo/config.py
echo "archive_name = '$repo_git_base archive'" >> config/nightly-repo/config.py
echo "archive_url = '$archive_url'" >> config/nightly-repo/config.py
echo "servergitmirrors = 'git@gitlab.com:$repo_git_base'" >> config/nightly-repo/config.py
echo "keystore = '$keystore'" >> config/nightly-repo/config.py
chmod 0600 config/nightly-repo/config.py
sed -i -e '/<\/string-array>/d' -e '/<\/resources>/d' \
app/src/main/res/values/default_repos.xml
echo "<item>$repo_git_base</item>" >> app/src/main/res/values/default_repos.xml
echo "<item>$repo_url</item>" >> app/src/main/res/values/default_repos.xml
cat config/nightly-repo/repo.xml >> app/src/main/res/values/default_repos.xml
echo "</string-array></resources>" >> app/src/main/res/values/default_repos.xml
set +x # do not show contents of secret variables!
echo $DEBUG_KEYSTORE | base64 --decode --ignore-garbage > $keystore
set -x
./gradlew assembleDebug -PdisablePreDex
mkdir config/nightly-repo/repo/
mv app/build/outputs/apk/app-debug.apk config/nightly-repo/repo/
cd config/nightly-repo
pw=android
alias=androiddebugkey
keytool -v -importkeystore \
-srckeystore $keystore -srcalias $alias -srcstorepass $pw -srckeypass $pw \
-destkeystore keystore.p12 -destalias $alias -deststorepass $pw -destkeypass $pw -deststoretype PKCS12
ssh_private_key=$HOME/.ssh/id_rsa
mkdir -p $(dirname $ssh_private_key)
openssl pkcs12 -in keystore.p12 -out key.pem -passin pass:$pw -passout pass:$pw
openssl rsa -in key.pem -out ${ssh_private_key} -passin pass:$pw
chmod 600 ${ssh_private_key}
ssh-keygen -y -f ${ssh_private_key} > ${ssh_private_key}.pub
echo "SSH public deploy key:"
cat ${ssh_private_key}.pub
eval $(ssh-agent -s)
ssh-add ${ssh_private_key}
if git clone $repo_base git-mirror; then
cd git-mirror
git remote rm origin
qr $repo_url > qr.png
echo "# $repo_git_base" > README.md
echo "[![$repo_url](qr.png)]($repo_url)" >> README.md
printf "\n\nLast updated: " >> README.md
date >> README.md
git add README.md
git config user.email "$CI_PROJECT_NAMESPACE@$CI_PROJECT_NAME"
git config user.name "$CI_PROJECT_NAMESPACE $CI_PROJECT_NAME"
git commit README.md -m README
cd ..
fi
if [ -d git-mirror/fdroid/repo ]; then
rsync -axv git-mirror/fdroid/repo/ repo/
fi
fdroid update --rename-apks
ssh-add -l
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" >> ~/.ssh/config
fdroid server update --verbose

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -1,15 +0,0 @@
Categories: System
License: GPL-3.0+
WebSite: https://f-droid.org
SourceCode: https://gitlab.com/fdroid/fdroidclient
IssueTracker: https://gitlab.com/fdroid/fdroidclient/issues
Changelog: https://gitlab.com/fdroid/fdroidclient/raw/HEAD/CHANGELOG.md
Donate: https://f-droid.org/about
FlattrID: 343053
Bitcoin: 15u8aAPK4jJ5N8wpWJ5gutAyyeHtKX5i18
AutoName: F-Droid Nightly
Summary: Nightly test build of F-Droid
RepoType: srclib
Repo: fdroidclient