Skip to content

test

test #22

Workflow file for this run

name: Android CI
on:
push:
branches: [ "github-action" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- 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: Create local.properties
run: |
echo "DEV_BASE_URL=\"DEV_BASE_URL\"" > local.properties
echo "PROD_BASE_URL=\"PROD_BASE_URL\"" >> local.properties
echo "key_alias=$key_alias" >> local.properties
echo "key_password=$key_password" >> local.properties
echo "store_password=$store_password" >> local.properties
shell: bash
env:
DEV_BASE_URL: ${{ secrets.DEV_BASE_URL }}
PROD_BASE_URL: ${{ secrets.PROD_BASE_URL }}
key_alias: ${{ secrets.ALIAS }}
key_password: ${{ secrets.KEY_PASSWORD }}
store_password: ${{ secrets.KEY_STORE_PASSWORD }}
- name: Decode keystore and create jks
run: echo "${{ secrets.SIGNING_KEY }}" | base64 --decode > nextroom_key
- name: Load Google Service file
run: echo $DATA | base64 -di > app/google-services.json
env:
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }}
- name: Build clean
run: ./gradlew clean
# - name: Run ktlint
# run: ./gradlew ktlintCheck
#
# - name: Run detekt
# run: ./gradlew detekt
- name: Build assemble debug apk
run: ./gradlew assembleDebug --stacktrace
- name: Build assemble release apk
run: ./gradlew assembleRelease --stacktrace
- name: Upload Debug APK
uses: actions/upload-artifact@v3
with:
name: debug
path: ./app/build/outputs/apk/debug/app-debug.apk
- name: Upload Release APK
uses: actions/upload-artifact@v3
with:
name: release
path: ./app/build/outputs/bundle/release/app-release.aab
- name: Upload apk to Firebase App Distribution
uses: wzieba/Firebase-Distribution-Github-Action@v1
with:
appId: ${{ secrets.FIREBASE_APP_ID }}
serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
groups: testers
file: app/build/outputs/apk/debug/app-debug.apk
# - name: Check
# run: |
# if [ -f ./app/build/outputs/bundle/release/ ]; then
# echo "File exists"
# else
# echo "File does not exist"
# exit 1
# fi
#
# - name: Publish to Play Store
# uses: r0adkll/upload-google-play@v1
# with:
# serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
# packageName: com.nextroom.nextroom
# releaseFiles: app/build/outputs/bundle/release/app-release.aab
# track: production
deploy:
name: Deploy aab to playstore
needs: build
runs-on: ubuntu-latest
steps:
- name: Download app bundle from artifact
uses: actions/download-artifact@v3
with:
name: app-bundle
- name: Publish to Play Store
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: com.nextroom.nextroom
releaseFiles: ${{ github.workspace }}/app-release.aab
track: production