🐛 修复 android ci #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'publish android' | |
on: | |
push: | |
tags: | |
- '*' | |
workflow_dispatch: | |
jobs: | |
publish-android: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Install NDK | |
run: | | |
sdkmanager "ndk;27.0.11902837" | |
echo "NDK_HOME=$ANDROID_HOME/ndk/27.0.11902837" >> $GITHUB_ENV | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- 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: Add NDK targets and tools to PATH | |
run: | | |
echo "$NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_PATH | |
- name: Install dependencies | |
run: pnpm install | |
- name: Init android app | |
run: pnpm tauri android init | |
env: | |
NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/27.0.11902837 | |
- name: Set Icon | |
run: pnpm tauri icon src-tauri/icons/icon.png | |
- 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 | |
run: pnpm tauri android build -v | |
env: | |
NDK_HOME: ${{ env.ANDROID_HOME }}/ndk/27.0.11902837 | |
- name: Get Node project version | |
id: package-version | |
uses: martinbeentjes/[email protected] | |
- name: Rename APK file | |
run: | | |
APK_VERSION=$(echo "${{ steps.package-version.outputs.current-version}}" | tr -d '\n') | |
mv ./src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release-unsigned.apk ./src-tauri/gen/android/app/build/outputs/apk/universal/release/matcha-${APK_VERSION}.apk | |
- name: Publish | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
name: matcha v${{ steps.package-version.outputs.current-version}} | |
tag_name: v${{ steps.package-version.outputs.current-version}} | |
generate_release_notes: true | |
files: | | |
./src-tauri/gen/android/app/build/outputs/apk/universal/release/matcha-${{ steps.package-version.outputs.current-version}}.apk | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |