|
| 1 | +name: Build and Release APKs |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-and-upload: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout code |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Set up JDK 17 |
| 17 | + uses: actions/setup-java@v4 |
| 18 | + with: |
| 19 | + java-version: '17' |
| 20 | + distribution: 'temurin' |
| 21 | + |
| 22 | + - name: Setup Bazel |
| 23 | + uses: bazel-contrib/[email protected] |
| 24 | + with: |
| 25 | + bazelisk-cache: true |
| 26 | + disk-cache: ${{ github.workflow }} |
| 27 | + repository-cache: true |
| 28 | + |
| 29 | + - name: Build AndroidX Test m2repository |
| 30 | + run: | |
| 31 | + bazel build :axt_m2repository |
| 32 | +
|
| 33 | + - name: Extract APKs from m2repository |
| 34 | + run: | |
| 35 | + unzip -o bazel-bin/axt_m2repository.zip -d extracted/ |
| 36 | +
|
| 37 | + - name: Create output directory |
| 38 | + run: mkdir -p apk-outputs |
| 39 | + |
| 40 | + - name: Copy APKs to output directory |
| 41 | + run: | |
| 42 | + # Copy test services APK |
| 43 | + cp extracted/repository/androidx/test/services/test-services/1.7.0-alpha01/test-services-1.7.0-alpha01.apk apk-outputs/android-test-services.apk |
| 44 | + |
| 45 | + # Copy orchestrator APK |
| 46 | + cp extracted/repository/androidx/test/orchestrator/1.7.0-alpha01/orchestrator-1.7.0-alpha01.apk apk-outputs/android-test-orchestrator.apk |
| 47 | + |
| 48 | + ls -la apk-outputs/ |
| 49 | +
|
| 50 | + - name: Upload APKs to Release |
| 51 | + if: github.event_name == 'release' |
| 52 | + uses: softprops/action-gh-release@v2 |
| 53 | + with: |
| 54 | + files: | |
| 55 | + apk-outputs/android-test-orchestrator.apk |
| 56 | + apk-outputs/android-test-services.apk |
| 57 | + env: |
| 58 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 59 | + |
| 60 | + - name: Upload APKs as Artifacts (for workflow_dispatch) |
| 61 | + if: github.event_name == 'workflow_dispatch' |
| 62 | + uses: actions/upload-artifact@v4 |
| 63 | + with: |
| 64 | + name: android-test-apks |
| 65 | + path: | |
| 66 | + apk-outputs/android-test-orchestrator.apk |
| 67 | + apk-outputs/android-test-services.apk |
0 commit comments