chore(workflow): replace gradle/gradle-build-action@v3 with uses: gra… #25
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 | ||
|
Check failure on line 1 in .github/workflows/build.yml
|
||
| on: | ||
| push: | ||
| branches: [ "master" ] | ||
| pull_request: | ||
| branches: [ "master" ] | ||
| workflow_dispatch: | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup JDK 17 | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: zulu | ||
| java-version: 17 | ||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@v4 | ||
| - name: Decode Keystore | ||
| if: secrets.SIGNING_KEYSTORE != '' | ||
| run: echo "${{ secrets.SIGNING_KEYSTORE }}" | base64 --decode > app/release.keystore | ||
| - name: Setup Gradle Signing Config | ||
| if: secrets.SIGNING_KEYSTORE != '' | ||
| run: | | ||
| echo -e "\nSTORE_FILE=release.keystore" >> gradle.properties | ||
| echo "STORE_PASSWORD=${{ secrets.STORE_PASSWORD }}" >> gradle.properties | ||
| echo "KEY_ALIAS=${{ secrets.KEY_ALIAS }}" >> gradle.properties | ||
| echo "KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}" >> gradle.properties | ||
| - name: Build Release APK | ||
| if: secrets.SIGNING_KEYSTORE != '' | ||
| run: ./gradlew assembleRelease --stacktrace | ||
| - name: Build Debug APK | ||
| if: secrets.SIGNING_KEYSTORE == '' | ||
| run: ./gradlew assembleDebug --stacktrace | ||
| - name: Build App Bundle | ||
| if: secrets.SIGNING_KEYSTORE != '' | ||
| run: ./gradlew bundleRelease --stacktrace | ||
| - name: Upload APK | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ secrets.SIGNING_KEYSTORE != '' && 'app-release.apk' || 'app-debug.apk' }} | ||
| path: ${{ secrets.SIGNING_KEYSTORE != '' && 'app/build/outputs/apk/release/app-release.apk' || 'app/build/outputs/apk/debug/app-debug.apk' }} | ||
| if-no-files-found: error | ||
| compression-level: 0 | ||
| - name: Upload Release App Bundle | ||
| if: secrets.SIGNING_KEYSTORE != '' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: app-release.aab | ||
| path: app/build/outputs/bundle/release/app-release.aab | ||
| if-no-files-found: error | ||
| compression-level: 0 | ||
| - name: Push APK to released repo | ||
| if: secrets.RELEASED_REPO_TOKEN != '' | ||
| run: | | ||
| git config --global user.name "github-actions[bot]" | ||
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
| git clone https://x-access-token:${{ secrets.RELEASED_REPO_TOKEN }}@github.com/mrepol742/released.git | ||
| cd released | ||
| mkdir -p android | ||
| cp ../app/build/outputs/apk/release/app-release.apk android/melvinjones-app.apk | ||
| git add android/melvinjones-app.apk | ||
| git commit -m "chore: update melvinjones-app.apk ($(date +'%Y-%m-%d %H:%M:%S'))" || echo "chore: initial commit" | ||
| git push origin master | ||