build: setup apk build #1
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 and Release | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: "zulu" | |
java-version: "17" | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: ${{ runner.os }}-gradle- | |
- name: Decode and Set Up Keystore | |
run: | | |
echo "${{ secrets.KEYSTORE_BASE64_ENCODED }}" | base64 -d > keystore.jks | |
- name: Setup keystore.properties | |
run: | | |
echo "store.file=keystore.jks" >> keystore.properties | |
echo "store.password=${{ secrets.KEYSTORE_PASSWORD }}" >> keystore.properties | |
echo "key.alias=tutortoise" >> keystore.properties | |
echo "key.password=${{ secrets.KEY_PASSWORD }}" >> keystore.properties | |
- name: Setup local.properties | |
run: | | |
echo "base.url=${{ secrets.BASE_URL }}" >> local.properties | |
echo "google.oauth.client.id=${{ secrets.GOOGLE_OAUTH_CLIENT_ID }}" >> local.properties | |
- name: Build Release APK | |
run: ./gradlew assembleRelease | |
env: | |
CI: true | |
- name: List APK Directory Contents | |
run: ls -alh app/build/outputs/apk/release/ | |
- name: Upload APK as Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: app-release | |
path: app/build/outputs/apk/release/app-release.apk | |
- name: Upload APK to Release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: app/build/outputs/apk/release/app-release.apk | |
asset_name: app-release.apk | |
asset_content_type: application/vnd.android.package-archive |