Preparing release for: zmNg-0.1.0 #27
Workflow file for this run
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: Build Android Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Release version (e.g., 1.0.0)' | |
| required: true | |
| type: string | |
| push: | |
| tags: | |
| - 'zmNg-*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-android: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: app/package-lock.json | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Install dependencies | |
| working-directory: ./app | |
| run: npm ci | |
| - name: Build web app | |
| working-directory: ./app | |
| run: npm run build | |
| - name: Sync Capacitor | |
| working-directory: ./app | |
| run: npx cap sync android | |
| - name: Build Android APK (debug, signed) | |
| working-directory: ./app/android | |
| run: ./gradlew assembleDebug | |
| - name: Build Android App Bundle (AAB, debug, signed) | |
| working-directory: ./app/android | |
| run: ./gradlew bundleDebug | |
| - name: Rename Android artifacts | |
| run: | | |
| VERSION="${{ github.event.inputs.version || github.ref_name }}" | |
| VERSION="${VERSION#zmNg-}" | |
| mkdir -p dist/android | |
| cp app/android/app/build/outputs/apk/debug/*.apk dist/android/zmNg-${VERSION}-android-debug.apk | |
| cp app/android/app/build/outputs/bundle/debug/*.aab dist/android/zmNg-${VERSION}-android-debug.aab | |
| - name: Upload APK artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: zmNg-android-apk-${{ github.event.inputs.version || github.ref_name }} | |
| path: dist/android/*.apk | |
| retention-days: 30 | |
| - name: Upload AAB artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: zmNg-android-aab-${{ github.event.inputs.version || github.ref_name }} | |
| path: dist/android/*.aab | |
| retention-days: 30 | |
| - name: Upload to Release | |
| uses: softprops/action-gh-release@v1 | |
| if: startsWith(github.ref, 'refs/tags/zmNg-') | |
| with: | |
| files: | | |
| dist/android/*.apk | |
| dist/android/*.aab | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |