Files
youtube-generator/.github/workflows/release-android.yml
T
poli0981andClaude Opus 5.5 701b661a0d chore(deps): fold the open Dependabot bumps; fix the vite launch-editor alerts
- i18n: i18next 26.4.4
- tauri: @tauri-apps/api 2.12.3, plugin-opener 2.7.1, cli 2.12.2
  (crates stay on 2.12)
- ui: lucide-react 1.55.0, radix-ui 1.8.0
- lint-and-format: eslint 10.12.0, knip 6.41.0, prettier 3.9.10,
  typescript-eslint 8.71.1
- build-tooling: @vitejs/plugin-react 6.1.2, marked 18.1.1,
  postcss 8.5.29, vite 8.3.4 (alerts #41-#43: launch-editor, fixed in 8.3.3)
- actions: setup-node 7.1.0, rust-toolchain 683b588, upload-artifact 7.0.2,
  scorecard 2.5.0
- THIRD_PARTY_NOTICES regenerated

Supersedes #197 #198 #199 #200 #201 #202 #203.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 14:40:53 +07:00

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@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
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"