feat: 添加播放历史同步功能及相关描述 #11
This file contains hidden or 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: Android APK | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths: | |
| - 'android/**' | |
| - 'templates/lyric-sphere-v2/dist/**' | |
| - '.github/workflows/android.yml' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Validate dist | |
| run: | | |
| if [ ! -d templates/lyric-sphere-v2/dist ]; then | |
| echo "::error::templates/lyric-sphere-v2/dist/ directory is missing" | |
| exit 1 | |
| fi | |
| if [ ! -f templates/lyric-sphere-v2/dist/index.html ]; then | |
| echo "::error::templates/lyric-sphere-v2/dist/index.html is missing" | |
| exit 1 | |
| fi | |
| if [ ! -d templates/lyric-sphere-v2/dist/assets ]; then | |
| echo "::error::templates/lyric-sphere-v2/dist/assets/ directory is missing" | |
| exit 1 | |
| fi | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| - name: Set up Android SDK | |
| uses: android-actions/setup-android@v3 | |
| - name: Install Android SDK 35 and build-tools | |
| run: | | |
| yes | sdkmanager --licenses | |
| sdkmanager --install "platforms;android-35" "build-tools;35.0.0" | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x android/gradlew | |
| - name: Resolve version label | |
| id: version | |
| run: | | |
| VERSION=$(grep -m1 'versionName' android/app/build.gradle.kts | sed -E 's/.*"([^"]+)".*/\1/') | |
| echo "app_version=${VERSION:-unknown}" >> "$GITHUB_OUTPUT" | |
| echo "git_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT" | |
| - name: Assemble debug APK | |
| working-directory: android | |
| run: ./gradlew :app:assembleDebug --no-daemon | |
| - name: Assemble release APK (unsigned) | |
| working-directory: android | |
| run: ./gradlew :app:assembleRelease --no-daemon | |
| - name: Upload debug APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: famyliam-android-debug-${{ steps.version.outputs.app_version }}-${{ steps.version.outputs.git_sha }} | |
| path: android/app/build/outputs/apk/debug/*.apk | |
| if-no-files-found: error | |
| retention-days: 14 | |
| - name: Upload release APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: famyliam-android-release-${{ steps.version.outputs.app_version }}-${{ steps.version.outputs.git_sha }} | |
| path: android/app/build/outputs/apk/release/*.apk | |
| if-no-files-found: error | |
| retention-days: 14 | |
| - name: Build summary | |
| run: | | |
| echo "### Android APK artifacts" >> "$GITHUB_STEP_SUMMARY" | |
| echo "- Version: \`${{ steps.version.outputs.app_version }}\`" >> "$GITHUB_STEP_SUMMARY" | |
| echo "- Commit: \`${{ steps.version.outputs.git_sha }}\`" >> "$GITHUB_STEP_SUMMARY" | |
| echo "- Debug: \`famyliam-android-debug-${{ steps.version.outputs.app_version }}-${{ steps.version.outputs.git_sha }}\`" >> "$GITHUB_STEP_SUMMARY" | |
| echo "- Release (unsigned): \`famyliam-android-release-${{ steps.version.outputs.app_version }}-${{ steps.version.outputs.git_sha }}\`" >> "$GITHUB_STEP_SUMMARY" |