Regexes with super-linear backtracking (S8786 x16) are rewritten to stay linear on long runs; each new pattern gives the same results as the old one on 150k-450k fuzzed inputs (except where noted) and finishes adversarial 50k-character inputs in under 3 ms: - tag-generator QUALIFIER_SUFFIX_RE starts just before a `:`/space run (`(^|[^:\s])…` + "$1"), never inside one - timeline-parser matches `line.trimEnd()` with a greedy label, and renders with trimEnd(); cleanCpuName collapses whitespace before the patterns - editor-store endings, Google Play urlPattern (lookahead for `id=`), channel-phrase punctuation, SPDX OR/AND split, legal-docs slug and link stripping (link text/URL may not contain `[`), base64url padding, and a loop for trailing slashes in the worker router Others: - S2871: sorts take the shared code-unit comparator (same order as before; THIRD_PARTY_NOTICES is unchanged) - S4822: ErrorBoundary catches the logger import with .catch(), which a try/catch never could - S3516: migrateProfilesState returns a new object - S7773: Number.parseInt (x10) - S9379: Modal takes an initialFocusRef (Radix onOpenAutoFocus), so the shortcut search box gets focus without an autoFocus attribute - S2245: generateId drops the Math.random fallback; getRandomValues exists everywhere the app runs, and a non-random ID is worse than an error - S4036: NOSONAR on the dev script's `git` call (PATH lookup by design) - S6505/S8543: every workflow installs with `npm ci --ignore-scripts`, and CI runs `npm run cf:check` instead of `npx wrangler …` - S6358: Android sets allowBackup="false" — app data is no longer copied to Google Drive backups; Backup & Restore moves it to a new phone Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
139 lines
5.5 KiB
YAML
139 lines
5.5 KiB
YAML
name: Release Android
|
|
|
|
on:
|
|
push:
|
|
tags: ["v*"]
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: "Tag to build (e.g. v1.0.0). The manifests must already carry this version."
|
|
required: true
|
|
type: string
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
# Same gate as release-desktop.yml: never sign an APK for a tag whose code
|
|
# fails the checks or whose version fields disagree with the tag.
|
|
verify:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
ref: ${{ github.event.inputs.tag || github.ref }}
|
|
persist-credentials: false
|
|
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
with:
|
|
node-version-file: .node-version
|
|
# Release artifacts are built from a clean install: a cache written
|
|
# by any other workflow must not be able to feed into them.
|
|
package-manager-cache: false
|
|
- run: npm ci --ignore-scripts
|
|
- run: npm run typecheck
|
|
- run: npm run test:run
|
|
- run: npm run check:version
|
|
- run: npm run check:tauri
|
|
- name: Tag matches the manifests
|
|
env:
|
|
TAG: ${{ github.event.inputs.tag || github.ref_name }}
|
|
run: |
|
|
version="v$(node -p "require('./package.json').version")"
|
|
if [ "$version" != "$TAG" ]; then
|
|
echo "::error::Tag $TAG does not match package.json ($version)"
|
|
exit 1
|
|
fi
|
|
|
|
build-android:
|
|
needs: verify
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write # upload the APK to the draft release
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
ref: ${{ github.event.inputs.tag || github.ref }}
|
|
persist-credentials: false
|
|
|
|
# No dependency caches in a release job (see release-desktop.yml).
|
|
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
with:
|
|
node-version-file: .node-version
|
|
# Release artifacts are built from a clean install: a cache written
|
|
# by any other workflow must not be able to feed into them.
|
|
package-manager-cache: false
|
|
|
|
- uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
|
|
with:
|
|
distribution: temurin
|
|
java-version: "17"
|
|
|
|
- uses: android-actions/setup-android@be39fa834029ff78f1a44aa3bb0819b8fc2bd8fd # v4.0.4
|
|
|
|
- name: Install Android NDK (r27 LTS)
|
|
run: sdkmanager "ndk;27.3.13750724"
|
|
|
|
# A master commit, not the regenerated `stable` branch — see rust.yml.
|
|
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8
|
|
with:
|
|
toolchain: stable
|
|
targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android
|
|
|
|
- run: npm ci --ignore-scripts
|
|
- name: Install Tauri CLI
|
|
run: cargo install tauri-cli --version "^2" --locked
|
|
|
|
- name: Decode keystore
|
|
env:
|
|
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
|
|
run: echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > "$RUNNER_TEMP/release.jks"
|
|
|
|
- name: Write keystore.properties
|
|
env:
|
|
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
|
|
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
|
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }}
|
|
run: |
|
|
{
|
|
echo "storeFile=$RUNNER_TEMP/release.jks"
|
|
echo "storePassword=$ANDROID_STORE_PASSWORD"
|
|
echo "keyAlias=$ANDROID_KEY_ALIAS"
|
|
echo "keyPassword=$ANDROID_KEY_PASSWORD"
|
|
} > src-tauri/gen/android/keystore.properties
|
|
|
|
- name: Build signed APK
|
|
env:
|
|
# Pin NDK_HOME to the exact version we installed above — the runner may
|
|
# ship a different default NDK that ANDROID_NDK_ROOT would point at.
|
|
NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/27.3.13750724
|
|
run: cargo tauri android build --apk
|
|
|
|
# Keep the APK regardless of whether the release upload works, so a
|
|
# broken upload never costs a 20-minute rebuild.
|
|
- name: Upload APK as workflow artifact
|
|
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
with:
|
|
name: ytdescgen-android-apk
|
|
path: src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk
|
|
if-no-files-found: error
|
|
|
|
# Uses `gh` (pre-installed on every runner) rather than a third-party
|
|
# action. `softprops/action-gh-release@v3` resolved the target release
|
|
# from GITHUB_REF instead of the `tag_name` it was given, so on a tag push
|
|
# it looked for a release tagged `refs/tags/v0.35.0` and on a
|
|
# workflow_dispatch it looked for one tagged `refs/heads/main` — neither
|
|
# exists, so it tried to CREATE a release on a branch ref and got
|
|
# "Resource not accessible by integration". The v0.35.0 APK was built
|
|
# three times before this was pinned down.
|
|
#
|
|
# `gh release upload` takes the tag as a positional argument and cannot
|
|
# make that mistake. `--clobber` makes a re-run idempotent.
|
|
- name: Upload APK to draft release
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
TAG: ${{ github.event.inputs.tag || github.ref_name }}
|
|
REPO: ${{ github.repository }}
|
|
APK: src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk
|
|
run: |
|
|
gh release upload "$TAG" "$APK" --clobber --repo "$REPO"
|