The first SonarQube Cloud scan reported 57 issues. 45 are fixed in code, the 11 on the saved itch.io test pages leave the scan via .sonarcloud.properties, and css:S8776 (Tailwind's @utility nesting) is a false positive to mark on SonarQube Cloud. Worker: trailing slashes and the gate cookie's padding are trimmed by trimEnd() instead of /\/+$/ (quadratic on the public 404 path); the feed and collection parsers lose their backtracking regexes; compareCodeUnits keeps the code-unit sorts (the rule's localeCompare is locale-dependent); Number.*, DEFAULT_SIZES, crypto.randomUUID; i18n-edit.mjs reads stdin. Pipeline: the NSFW notices are one selector list, either class (the rule's ".a.b" would need both), each tested; plain if-guards; update_info.main returns None; no plain-http adapter; [[ ]] in cf_build_status.sh. Supply chain: requirements*.txt are hash-locked pip-tools compiles of requirements*.in (on Python 3.14, which Dependabot reads from the header), installed with --require-hashes --only-binary :all: in block scalars; npm ci --ignore-scripts in CI and the release builds (verified by manual release runs on all platforms); npm run cf:check. Release 4.4.2: also ships the toolchain upgrade (#149, #154) and Dependabot #141-#148, #150, #152, #153. CLAUDE.md gotchas 40 and 41. [skip-discuss] Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
154 lines
6.1 KiB
YAML
154 lines
6.1 KiB
YAML
name: Release Android APK (Tauri)
|
|
|
|
# Builds a signed, sideloadable arm64-v8a APK from the same React + Tauri app
|
|
# that release_desktop.yml ships for desktop.
|
|
#
|
|
# - On a `v*` tag: attaches the APK to the same DRAFT GitHub Release as the
|
|
# desktop installers (nothing is published — release stays a draft until a
|
|
# human publishes it).
|
|
# - On manual dispatch: uploads the APK as a workflow artifact so it can be
|
|
# downloaded and device-tested without cutting a tag.
|
|
#
|
|
# `src-tauri/gen/android` is gitignored and regenerated by `tauri android init`
|
|
# on every run, so signing is done AFTER the build with zipalign + apksigner
|
|
# (no edits to generated Gradle). Order matters: zipalign BEFORE apksigner —
|
|
# re-aligning a signed APK breaks the signature.
|
|
|
|
on:
|
|
push:
|
|
tags: ['v*']
|
|
workflow_dispatch:
|
|
|
|
# Pin the NDK so CI matches local (a floating NDK is a classic
|
|
# "works locally, breaks in CI"). 27.3.x is the current stable LTS and is
|
|
# installed on the dev machine; to match locally, point NDK_HOME at the same
|
|
# version (otherwise Tauri picks the highest installed NDK).
|
|
env:
|
|
NDK_VERSION: '27.3.13750724'
|
|
|
|
permissions: {}
|
|
|
|
concurrency:
|
|
group: release-android-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
build-android:
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 90
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: Set up JDK
|
|
uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
|
|
with:
|
|
distribution: temurin
|
|
java-version: '17'
|
|
# No `cache: gradle` — the Gradle project lives in gen/android, which
|
|
# is gitignored and only created later by `tauri android init`, so
|
|
# there are no gradle files at checkout for setup-java to key on
|
|
# (it hard-errors otherwise). Release builds use no caches at all.
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
with:
|
|
node-version-file: webapp/.node-version
|
|
# No dependency cache in release builds: a poisoned cache could end
|
|
# up inside signed installers. Releases are rare; take the extra minutes.
|
|
package-manager-cache: false
|
|
|
|
- name: Set up Rust
|
|
uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master
|
|
with:
|
|
toolchain: stable
|
|
targets: aarch64-linux-android
|
|
|
|
|
|
- name: Set up Android SDK
|
|
uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4
|
|
|
|
- name: Install NDK + build-tools + platform
|
|
# Tauri 2.11 generates compileSdk/targetSdk = 36, so provision android-36
|
|
# and a matching build-tools (these versions match the dev machine).
|
|
run: |
|
|
sdkmanager "ndk;${NDK_VERSION}" "build-tools;36.1.0" "platforms;android-36" "platform-tools"
|
|
echo "NDK_HOME=$ANDROID_HOME/ndk/${NDK_VERSION}" >> "$GITHUB_ENV"
|
|
|
|
- name: Install npm deps
|
|
working-directory: webapp
|
|
run: npm ci --ignore-scripts
|
|
|
|
- name: Initialize Android project
|
|
working-directory: webapp
|
|
run: npm run tauri -- android init
|
|
|
|
- name: Build unsigned release APK (arm64-v8a)
|
|
working-directory: webapp
|
|
run: npm run tauri -- android build --apk --target aarch64
|
|
|
|
- name: Sign APK (zipalign -> apksigner)
|
|
id: sign
|
|
working-directory: webapp
|
|
env:
|
|
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
|
|
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
|
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
|
|
run: |
|
|
set -euo pipefail
|
|
# Highest installed build-tools (provides zipalign + apksigner).
|
|
BT=$(ls -d "$ANDROID_HOME"/build-tools/* | sort -V | tail -1)
|
|
VERSION=$(node -p "require('./src-tauri/tauri.conf.json').version")
|
|
OUT="FreeGamesItchio_${VERSION}_arm64-v8a.apk"
|
|
|
|
echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.jks"
|
|
|
|
UNSIGNED=$(find src-tauri/gen/android/app/build/outputs/apk \
|
|
-name "*-release-unsigned.apk" | head -1)
|
|
if [ -z "$UNSIGNED" ]; then
|
|
echo "::error::No *-release-unsigned.apk found — build produced no unsigned APK."
|
|
exit 1
|
|
fi
|
|
echo "Unsigned APK: $UNSIGNED"
|
|
|
|
"$BT/zipalign" -v -p 4 "$UNSIGNED" aligned.apk
|
|
"$BT/apksigner" sign \
|
|
--ks "$RUNNER_TEMP/release.jks" \
|
|
--ks-key-alias "$ANDROID_KEY_ALIAS" \
|
|
--ks-pass "pass:$ANDROID_KEYSTORE_PASSWORD" \
|
|
--key-pass "pass:$ANDROID_KEYSTORE_PASSWORD" \
|
|
--out "$OUT" aligned.apk
|
|
"$BT/apksigner" verify --verbose "$OUT"
|
|
rm -f "$RUNNER_TEMP/release.jks" aligned.apk
|
|
|
|
echo "apk_path=webapp/$OUT" >> "$GITHUB_OUTPUT"
|
|
echo "apk_name=$OUT" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Upload APK as workflow artifact
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: ${{ steps.sign.outputs.apk_name }}
|
|
path: ${{ steps.sign.outputs.apk_path }}
|
|
if-no-files-found: error
|
|
|
|
- name: Attach APK to draft release (tag only)
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
TAG: ${{ github.ref_name }}
|
|
REPO: ${{ github.repository }}
|
|
APK_PATH: ${{ steps.sign.outputs.apk_path }}
|
|
run: |
|
|
set -euo pipefail
|
|
# release_desktop.yml's create-release job normally made the draft
|
|
# minutes ago; create it only as a fallback (tolerating a race).
|
|
gh release view "$TAG" --repo "$REPO" >/dev/null 2>&1 \
|
|
|| gh release create "$TAG" --repo "$REPO" --draft --verify-tag \
|
|
--title "Free Itch Games $TAG" --generate-notes \
|
|
|| gh release view "$TAG" --repo "$REPO" >/dev/null
|
|
gh release upload "$TAG" "$APK_PATH" --repo "$REPO" --clobber
|