VerveDo/.github/workflows/android_ci.yml
Super12138 d41baec795 feat(ci): 尝试安装 NDK 以减小 APK 体积
顺便支持过滤掉一些不必触发工作流的文件
2025-03-19 22:18:47 +08:00

55 lines
No EOL
1.9 KiB
YAML

name: Android CI
on:
push:
branches: [ "main" ]
paths-ignore: [ "**.md", "LICENSE", ".gitignore", ".github/ISSUE_TEMPLATE/**", "art/**", "fastlane/**" ]
pull_request:
branches: [ "main" ]
paths-ignore: [ "**.md", "LICENSE", ".gitignore", ".github/ISSUE_TEMPLATE/**", "art/**", "fastlane/**" ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
- name: set up JDK 21
uses: actions/setup-java@v4.7.0
with:
java-version: '21'
distribution: 'temurin'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Write sign info
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'Super12138/ToDo'
run: |
if [ ! -z "${{ secrets.SIGNING_KEY }}" ]; then
echo releaseStorePassword='${{ secrets.KEY_STORE_PASSWORD }}' >> gradle.properties
echo releaseKeyAlias='${{ secrets.ALIAS }}' >> gradle.properties
echo releaseKeyPassword='${{ secrets.KEY_PASSWORD }}' >> gradle.properties
echo releaseStoreFile='${{ github.workspace }}/key.jks' >> gradle.properties
echo ${{ secrets.SIGNING_KEY }} | base64 --decode > ${{ github.workspace }}/key.jks
fi
- name: Setup Android NDK
uses: nttld/setup-ndk@v1.5.0
with:
ndk-version: r27c
# link-to-sdk: true
- name: Build with Gradle
run: ./gradlew assembleRelease
- name: Upload APK
if: success() && github.event_name != 'pull_request' && github.repository == 'Super12138/ToDo'
uses: actions/upload-artifact@v4.6.1
with:
name: Release
path: ${{ github.workspace }}/app/build/outputs/apk/release