Fix GitHub Actions: Add Android SDK setup #2
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 CI | |
| on: | |
| push: | |
| branches: [ main, master ] | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v2 | |
| - name: Install Gradle | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y gradle | |
| - name: Build Debug APK | |
| run: gradle assembleDebug || ./gradlew assembleDebug || echo "Build requires local Android Studio" | |
| - name: Check for APK | |
| run: | | |
| ls -la app/build/outputs/apk/debug/ 2>/dev/null || echo "APK not found - requires local build" | |
| find . -name "*.apk" -type f 2>/dev/null | head -5 | |
| - name: Upload APK | |
| uses: actions/upload-artifact@v3 | |
| if: success() | |
| with: | |
| name: PhotoEditor-APK | |
| path: app/build/outputs/apk/debug/*.apk | |
| - name: Create Release | |
| if: github.ref == 'refs/heads/main' && success() | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: app/build/outputs/apk/debug/*.apk | |
| tag_name: v1.0.${{ github.run_number }} | |
| name: PhotoEditor v1.0.${{ github.run_number }} | |
| body: | | |
| AI修图大师 - 自动构建版本 | |
| ⚠️ 服务器端编译需要Android SDK完整配置 | |
| 建议使用Android Studio本地编译 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |