Skip to content

release

release #13

Workflow file for this run

name: 'release'
on:
workflow_dispatch:
push:
tags:
- "v*"
jobs:
publish-tauri:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest' # for Arm based macs (M1 and above).
args: '--target aarch64-apple-darwin'
- platform: 'macos-latest' # for Intel based macs.
args: '--target x86_64-apple-darwin'
- platform: 'ubuntu-22.04'
args: ''
- platform: 'windows-latest'
args: ''
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Install dependencies (Ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Setup Bun
uses: oven-sh/setup-bun@v1
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: Install frontend dependencies
run: bun install
- uses: tauri-apps/tauri-action@v0
id: tauri
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: app-v__VERSION__
releaseName: 'App v__VERSION__'
releaseBody: 'See the assets to download this version and install.'
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
build-android:
runs-on: ubuntu-latest
needs: publish-tauri
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '17'
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android
- name: Setup Bun
uses: oven-sh/setup-bun@v1
- name: Install frontend dependencies
run: bun install
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Install NDK
run: sdkmanager "ndk;27.0.11902837"
- name: setup Android signing
run: |
cd src-tauri/gen/android
echo "keyAlias=${{ secrets.ANDROID_KEY_ALIAS }}" > keystore.properties
echo "password=${{ secrets.ANDROID_KEY_PASSWORD }}" >> keystore.properties
base64 -d <<< "${{ secrets.ANDROID_KEY_BASE64 }}" > $RUNNER_TEMP/keystore.jks
echo "storeFile=$RUNNER_TEMP/keystore.jks" >> keystore.properties
- name: Build app bundle
id: build
run: |
bun tauri android build --apk
apk_path="src-tauri/gen/android/app/build/outputs/apk/universal/release/"
echo apk_path=$apk_path >> $GITHUB_ENV
env:
NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/27.0.11902837
- name: Verify APK signing
run: |
apk_path="${{ steps.build.outputs.apk_path }}"
for apk in $apk_path/*.apk; do
echo "Verifying $apk..."
if jarsigner -verify -certs "$apk"; then
echo "Verification PASSED for $apk"
else
echo "Verification FAILED for $apk"
fi
done
- name: Align the Universal APK (optional but recommended)
run: |
apk_path="${{ steps.build.outputs.apk_path }}"
zipalign_path="${ANDROID_HOME}/build-tools/30.0.3/zipalign"
for apk in $apk_path/*.apk; do
$zipalign_path -v 4 "$apk" "$apk"
done
- name: Rename APKs
run: |
apk_path="${{ steps.build.outputs.apk_path }}"
version_name=$(grep versionName build.gradle.kts | sed 's/.*versionName = "\(.*\)"/\1/')
for apk in $apk_path/*.apk; do
abi=$(basename "$apk" | sed 's/app-universal-\(.*\)-release.apk/\1/')
new_name="biliresourcedownloader_${version_name}_android_${abi}.apk"
mv "$apk" "$apk_path/$new_name"
echo "Renamed $apk to $new_name"
done
- name: Upload APKs to release created by tauri-action
uses:
softprops/action-gh-release@v1
with:
draft: true
files: |
'src-tauri/gen/android/app/build/outputs/apk/universal/release/*.apk'
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.tauri.outputs.tag }}