Files
mrambossekandClaude Opus 5 6ddf013dfe License the project; add root README, website, and parked release CI
- Code: GPL-3.0-or-later (LICENSE, SPDX headers on all .kt/.aidl).
  Specs in docs/: CC-BY-4.0 (docs/LICENSE). Rationale in build-status.md;
  server decided GPL (not AGPL).
- Root README for the public repo.
- web/: Cloudflare Worker site for echo-lot.app. /apk resolves the newest
  APK from the Gitea latest-release API at request time (edge-cached 5 min),
  so tagging a release is the only publish step. /fdroid, /source, and a
  manual DOWNLOAD_URL fallback are wrangler vars.
- .gitea/workflows/release.yml: tag-driven (v*) signed semver APK builds for
  the future production app in echolot-app/. Parked; the prober is
  deliberately not CI-built.
- Fix UserService.kt: drop the explicit secondary constructor that
  conflicted with the implicit primary (never compiled before — first
  local build caught it). Prober now builds: :app:assembleDebug OK.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-30 09:15:35 +02:00

100 lines
4.0 KiB
YAML

# Builds a signed, semantically versioned APK of the PRODUCTION APP on every
# v* tag and attaches it to a Gitea release. The website resolves "latest"
# through the Gitea API at request time, so publishing a release is the ONLY
# step — no site redeploy.
#
# PARKED until the production app lands in echolot-app/ (the prober is a
# one-shot tool and deliberately not CI-built). Runs only on v* tags, so it
# stays inert until the first tag is pushed. When echolot-app exists it needs
# the tag-derived version wiring in its build.gradle.kts:
# versionName from -PversionName, versionCode from -PversionCode,
# keystore.properties (gitignored) for release signing.
#
# Required repo secrets (Settings → Actions → Secrets):
# KEYSTORE_B64 base64 of the release keystore (base64 -w0 echolot.jks)
# KEYSTORE_PASSWORD store password
# KEY_ALIAS key alias
# KEY_PASSWORD key password
# RELEASE_TOKEN is NOT needed: the built-in GITHUB_TOKEN can create releases.
#
# Tag to release: git tag v0.2.0 && git push origin v0.2.0
name: release-apk
on:
push:
tags: ["v*.*.*"]
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: echolot-app
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- name: Install Android SDK cmdline tools
run: |
sudo mkdir -p /opt/android-sdk/cmdline-tools
curl -sSL -o /tmp/clt.zip https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
sudo unzip -q /tmp/clt.zip -d /opt/android-sdk/cmdline-tools
sudo mv /opt/android-sdk/cmdline-tools/cmdline-tools /opt/android-sdk/cmdline-tools/latest
echo "ANDROID_HOME=/opt/android-sdk" >> "$GITHUB_ENV"
yes | sudo /opt/android-sdk/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null
sudo /opt/android-sdk/cmdline-tools/latest/bin/sdkmanager "platforms;android-35" "build-tools;35.0.0" > /dev/null
- name: Derive version from tag
id: ver
run: |
NAME="${GITHUB_REF_NAME#v}" # v1.2.3 -> 1.2.3
IFS='.' read -r MAJ MIN PAT <<< "${NAME%%-*}" # strip -rc1 etc. for the code
CODE=$((MAJ * 10000 + MIN * 100 + PAT))
echo "name=$NAME" >> "$GITHUB_OUTPUT"
echo "code=$CODE" >> "$GITHUB_OUTPUT"
- name: Materialize keystore
env:
KEYSTORE_B64: ${{ secrets.KEYSTORE_B64 }}
run: |
echo "$KEYSTORE_B64" | base64 -d > release.jks
cat > keystore.properties <<EOF
storeFile=release.jks
storePassword=${{ secrets.KEYSTORE_PASSWORD }}
keyAlias=${{ secrets.KEY_ALIAS }}
keyPassword=${{ secrets.KEY_PASSWORD }}
EOF
- name: Build release APK
run: |
./gradlew --no-daemon :app:assembleRelease \
-PversionName=${{ steps.ver.outputs.name }} \
-PversionCode=${{ steps.ver.outputs.code }}
- name: Rename + checksum
id: apk
run: |
APK="echolot-prober-${{ steps.ver.outputs.name }}.apk"
cp app/build/outputs/apk/release/app-release.apk "$APK"
sha256sum "$APK" > "$APK.sha256"
echo "file=$APK" >> "$GITHUB_OUTPUT"
- name: Create Gitea release + attach assets
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
run: |
REL=$(curl -sf -X POST "$API/releases" \
-H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
-d "{\"tag_name\":\"$GITHUB_REF_NAME\",\"name\":\"$GITHUB_REF_NAME\",\"draft\":false,\"prerelease\":false}")
ID=$(echo "$REL" | jq -r .id)
for f in "${{ steps.apk.outputs.file }}" "${{ steps.apk.outputs.file }}.sha256"; do
curl -sf -X POST "$API/releases/$ID/assets?name=$f" \
-H "Authorization: token $TOKEN" \
-F "attachment=@$f"
done