- vitest + @vitest/coverage-v8 4.1.12: @vitest/mocker 4.1.12 fixes alerts #44 and #45 (manual-mock code injection, Windows redirect traversal). Dependabot's security update could not land on its own: vitest 4.1.11 pins @vitest/mocker 4.1.11. - i18n: i18next 26.4.5 - tauri: @tauri-apps/api 2.12.4, plugin-opener 2.7.2, cli 2.12.3 - ui: lucide-react 1.57.0, radix-ui 1.8.1 - lint-and-format: typescript-eslint 8.71.2 - build-tooling: postcss 8.5.30 - actions: setup-java 6.1.0, zizmor-action 0.7.1 - THIRD_PARTY_NOTICES regenerated Supersedes #197 #198 #199 #206 #207 #208. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
140 lines
5.5 KiB
YAML
140 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
|
|
- 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
|
|
|
|
- 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"
|