Bump gradle/gradle-build-action from 2 to 3 (#22) #93
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: Android | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Validate Gradle Wrapper | |
uses: gradle/wrapper-validation-action@v1 | |
- name: Set up signing key | |
if: github.ref == 'refs/heads/main' | |
run: | | |
if [ ! -z "${{ secrets.KEY_STORE }}" ]; then | |
echo keyStorePassword='${{ secrets.KEY_STORE_PASSWORD }}' >> signing.properties | |
echo keyAlias='${{ secrets.KEY_ALIAS }}' >> signing.properties | |
echo keyPassword='${{ secrets.KEY_PASSWORD }}' >> signing.properties | |
echo keyStore='${{ github.workspace }}/key.jks' >> signing.properties | |
echo ${{ secrets.KEY_STORE }} | base64 --decode > ${{ github.workspace }}/key.jks | |
fi | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: 17 | |
- name: Set up Gradle | |
uses: gradle/gradle-build-action@v3 | |
with: | |
gradle-home-cache-cleanup: true | |
- name: Build with Gradle | |
run: ./gradlew assembleRelease | |
- name: Get release name | |
if: success() && github.ref == 'refs/heads/main' | |
id: release-name | |
run: | | |
name=`ls app/build/outputs/apk/release/*.apk | awk -F '(/|.apk)' '{print $6}'` && echo "name=${name}" >> $GITHUB_OUTPUT | |
- name: Upload built apk | |
if: success() && github.ref == 'refs/heads/main' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.release-name.outputs.name }} | |
path: app/build/outputs/apk/release/*.apk | |
- name: Upload mappings | |
if: success() && github.ref == 'refs/heads/main' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mappings | |
path: app/build/outputs/mapping/release |