Android CD #3
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 CD | |
on: | |
push: | |
branches: | |
- release | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: Android CI/CD | |
steps: | |
- uses: actions/checkout@v3 | |
- name: set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
- name: Cache Gradle packages | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Access BASE_URL | |
env: | |
GNR_BASE_URL: ${{ secrets.GNR_BASE_URL }} | |
run: echo GNR_BASE_URL=\"$GNR_BASE_URL\" > ./local.properties | |
- name: Generate Debug Keystore file from Github Secrets | |
run: | | |
mkdir ./app/keystore | |
echo "$KEYSTORE" > ./app/keystore/debug_keystore.b64 | |
base64 -d -i ./app/keystore/debug_keystore.b64 > ./app/keystore/debug.keystore | |
env: | |
KEYSTORE: ${{ secrets.DEBUG_KEYSTORE_BASE64 }} | |
- name: Build with Gradle | |
run: ./gradlew assembleDebug | |
- name: Send APK to Slack | |
uses: MeilCli/slack-upload-file@v1 | |
with: | |
token: ${{ secrets.SLACK_BOT_TOKEN }} | |
path: ./app/build/outputs/apk/debug/app-debug.apk | |
channel: release-android | |
filename: debug_apk.apk | |
initial_comment: ${{ github.event.head_commit.message }} |