Skip to content

F-Droid build check

F-Droid build check #2

Workflow file for this run

name: F-Droid build check
on:
workflow_dispatch:
# push:
# branches:
# - main
# paths:
# - 'app/**'
# - 'build.gradle.kts'
# - 'settings.gradle.kts'
# - 'gradle/**'
# - 'top.stevezmt.calsync.yml'
# - '.github/workflows/fdroid-build.yml'
jobs:
fdroid-build:
runs-on: ubuntu-latest
timeout-minutes: 60
env:
PKG_ID: top.stevezmt.calsync
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Prepare fdroiddata structure
run: |
set -euo pipefail
mkdir -p fdroiddata/metadata
# Use repository metadata, but override commit to current SHA for CI reproducibility
if [[ -f "top.stevezmt.calsync.yml" ]]; then
cp top.stevezmt.calsync.yml fdroiddata/metadata/${PKG_ID}.yml
else
echo "ERROR: top.stevezmt.calsync.yml not found at repo root" >&2
exit 1
fi
# Replace or insert commit field to point to the current commit so container can fetch it
if grep -qE '^\s*commit:\s*' fdroiddata/metadata/${PKG_ID}.yml; then
sed -i "0,/^\s*commit:\s*.*/s// commit: ${GITHUB_SHA}/" fdroiddata/metadata/${PKG_ID}.yml
else
# add commit under the first build block if not present
awk -v sha="${GITHUB_SHA}" '
{print}
/^\s*-\s*versionName:/ {inbuild=1}
inbuild && /^\s*subdir:/ {print " commit: " sha}
' fdroiddata/metadata/${PKG_ID}.yml > fdroiddata/metadata/${PKG_ID}.yml.tmp && mv fdroiddata/metadata/${PKG_ID}.yml.tmp fdroiddata/metadata/${PKG_ID}.yml
fi
echo "--- Effective metadata ---"
sed -n '1,200p' fdroiddata/metadata/${PKG_ID}.yml
- name: Clone fdroidserver (shallow)
run: |
git clone --depth=1 https://gitlab.com/fdroid/fdroidserver fdroidserver
- name: Run build in fdroidserver container
run: |
set -euo pipefail
docker run --rm -t \
-e PKG_ID=${PKG_ID} \
-v "${{ github.workspace }}/fdroiddata:/build" \
-v "${{ github.workspace }}/fdroidserver:/home/vagrant/fdroidserver" \
registry.gitlab.com/fdroid/fdroidserver:buildserver \
bash -lc '
set -euo pipefail
. /etc/profile
export fdroidserver=/home/vagrant/fdroidserver
export PATH="$fdroidserver:$PATH"
export PYTHONPATH="$fdroidserver"
echo "PKG_ID=${PKG_ID}"
cd /build
echo "[fdroid] readmeta" && fdroid readmeta
echo "[fdroid] lint ${PKG_ID}" && fdroid lint ${PKG_ID} || true
echo "[fdroid] build ${PKG_ID}" && fdroid build ${PKG_ID}
'
- name: List outputs
if: always()
run: |
echo "== repo ==" && ls -la fdroiddata/repo || true
echo "== unsigned ==" && ls -la fdroiddata/unsigned || true
echo "== tmp ==" && ls -la fdroiddata/tmp || true
- name: Upload artifacts (repo)
if: always()
uses: actions/upload-artifact@v4
with:
name: fdroid-repo
path: fdroiddata/repo
if-no-files-found: warn
- name: Upload artifacts (unsigned)
if: always()
uses: actions/upload-artifact@v4
with:
name: fdroid-unsigned
path: fdroiddata/unsigned
if-no-files-found: warn
- name: Upload artifacts (tmp)
if: always()
uses: actions/upload-artifact@v4
with:
name: fdroid-tmp
path: fdroiddata/tmp
if-no-files-found: warn