split debug and release build #23
This file contains 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 | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches: | |
- main | |
- develop | |
jobs: | |
build-android-debug: | |
name: Build Android Debug | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Setup Environment (PR) | |
if: ${{ github.event_name == 'pull_request' }} | |
shell: bash | |
run: echo "SHA_SHORT=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-7)" >> $GITHUB_ENV | |
- name: Setup Environment (Push) | |
if: ${{ github.event_name == 'push' }} | |
shell: bash | |
run: echo "SHA_SHORT=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm install | |
- name: Generate build files | |
run: npx expo prebuild --platform android | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }} | |
- name: Build Debug APK | |
working-directory: android | |
run: | |
./gradlew assembleDebug "-Dorg.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m" | |
- name: Upload Debug APK | |
id: upload-debug | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-debug-${{ env.SHA_SHORT }} | |
path: android/app/build/outputs/apk/debug/*.apk | |
- name: Comment on PR | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
append: true | |
message: | | |
[Download Debug APK](${{ steps.upload-debug.outputs.artifact-url }}) | |
> Latest commit: [${{ env.SHA_SHORT }}](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}) | |
build-android-release: | |
name: Build Android Release | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Setup Environment (PR) | |
if: ${{ github.event_name == 'pull_request' }} | |
shell: bash | |
run: echo "SHA_SHORT=$(echo ${{ github.event.pull_request.head.sha }} | cut -c1-7)" >> $GITHUB_ENV | |
- name: Setup Environment (Push) | |
if: ${{ github.event_name == 'push' }} | |
shell: bash | |
run: echo "SHA_SHORT=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV | |
- name: Check out Git repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm install | |
- name: Generate build files | |
run: npx expo prebuild --platform android | |
- name: Setup JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
cache-read-only: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/develop' }} | |
- name: Build Release APK | |
working-directory: android | |
run: | |
./gradlew assembleRelease "-Dorg.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=512m" | |
- name: Upload Release APK | |
id: upload-debug | |
uses: actions/upload-artifact@v4 | |
with: | |
name: app-release-${{ env.SHA_SHORT }} | |
path: android/app/build/outputs/apk/release/*.apk | |
- name: Comment on PR | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
append: true | |
message: | | |
[Download Release APK](${{ steps.upload-release.outputs.artifact-url }}) | |
> Latest commit: [${{ env.SHA_SHORT }}](https://github.com/${{ github.repository }}/commit/${{ github.event.pull_request.head.sha }}) |