mirror of
https://github.com/KRTirtho/spotube.git
synced 2026-11-04 10:13:59 +00:00
ci: add standalone build-android-apk workflow with automatic keystore generation
Co-Authored-By: pgwiz <pgwiz@users.noreply.github.com>
This commit is contained in:
parent
f622b4b155
commit
3ce36d624b
115
.github/workflows/build-android-apk.yml
vendored
Normal file
115
.github/workflows/build-android-apk.yml
vendored
Normal file
@ -0,0 +1,115 @@
|
||||
name: Build Android APK
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Release tag (e.g. v6.0.0-custom or nightly)'
|
||||
required: false
|
||||
default: 'nightly'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
build-apk:
|
||||
name: Build Spotube Android APK
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 90
|
||||
steps:
|
||||
- name: Checkout spotube
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Checkout ComposeNativeWebview
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: KRTirtho/ComposeNativeWebview
|
||||
ref: cbd36f88927298a28a2d64c6acf7ec3b2def6f9d
|
||||
path: compose-webview
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: 21
|
||||
|
||||
- name: Set up Android SDK
|
||||
uses: android-actions/setup-android@v4
|
||||
|
||||
- name: Set up Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
|
||||
- name: Set up Gradle
|
||||
uses: gradle/actions/setup-gradle@v4
|
||||
|
||||
- name: Publish compose-webview to mavenLocal
|
||||
working-directory: compose-webview
|
||||
run: |
|
||||
chmod +x gradlew
|
||||
./gradlew publishToMavenLocal
|
||||
|
||||
- name: Configure Android signing
|
||||
working-directory: composeApp
|
||||
env:
|
||||
KEYSTORE: ${{ secrets.KEYSTORE }}
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }}
|
||||
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
|
||||
run: |
|
||||
chmod +x ../gradlew
|
||||
if [ -n "$KEYSTORE" ]; then
|
||||
echo "$KEYSTORE" | base64 --decode > "${{ github.workspace }}/composeApp/upload-keystore.jks"
|
||||
cat >> local.properties <<EOF
|
||||
release.signing.storeFile=${{ github.workspace }}/composeApp/upload-keystore.jks
|
||||
release.signing.storePassword=${KEYSTORE_PASSWORD}
|
||||
release.signing.keyAlias=${KEYSTORE_KEY_ALIAS}
|
||||
release.signing.keyPassword=${KEYSTORE_KEY_PASSWORD}
|
||||
EOF
|
||||
else
|
||||
echo "No custom keystore secret found, generating build keystore..."
|
||||
keytool -genkey -v -keystore "${{ github.workspace }}/composeApp/upload-keystore.jks" -alias spotube -keyalg RSA -keysize 2048 -validity 10000 -storepass spotubepass -keypass spotubepass -dname "CN=Spotube, OU=Mobile, O=Spotube, C=US"
|
||||
cat >> local.properties <<EOF
|
||||
release.signing.storeFile=${{ github.workspace }}/composeApp/upload-keystore.jks
|
||||
release.signing.storePassword=spotubepass
|
||||
release.signing.keyAlias=spotube
|
||||
release.signing.keyPassword=spotubepass
|
||||
EOF
|
||||
fi
|
||||
|
||||
- name: Assemble Android Release APK
|
||||
run: |
|
||||
./gradlew :composeApp:assembleNightlyRelease -Pnightly=true -PbuildNumber=${{ github.run_number }} --stacktrace
|
||||
|
||||
- name: Locate and Rename APK
|
||||
run: |
|
||||
APK_FILE=$(find composeApp/build/outputs/apk -name "*.apk" -type f | grep -i "release" | head -1)
|
||||
if [ -z "$APK_FILE" ]; then
|
||||
APK_FILE=$(find composeApp/build/outputs/apk -name "*.apk" -type f | head -1)
|
||||
fi
|
||||
echo "Found APK at: $APK_FILE"
|
||||
cp "$APK_FILE" Spotube-android-all-arch.apk
|
||||
ls -lh Spotube-android-all-arch.apk
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: Spotube-android-all-arch
|
||||
path: Spotube-android-all-arch.apk
|
||||
|
||||
- name: Create or Update GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ inputs.tag || 'nightly' }}
|
||||
name: "Spotube Android Build (${{ inputs.tag || 'nightly' }})"
|
||||
body: |
|
||||
### Spotube Custom Android Build
|
||||
Compiled automatically with custom playback & proxy fixes:
|
||||
- **Google Video 403 Forbidden Fix:** Upstream headers with `Referer: https://www.youtube.com/`, `Origin`, and browser `User-Agent`.
|
||||
- **YouTube Video ID Extraction:** Fixed parsing from `externalUri` instead of passing Spotify ID.
|
||||
- **Relaxed Matching:** Top relevance fallback to prevent `TrackNotFoundError`.
|
||||
- **Native YouTube Endless Playback:** Radio mix via `list=RD{videoId}`.
|
||||
files: Spotube-android-all-arch.apk
|
||||
prerelease: true
|
||||
draft: false
|
||||
Loading…
Reference in New Issue
Block a user