Update debug.yml #27
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: Generate Debug | |
on: | |
workflow_dispatch: | |
inputs: | |
buildType: | |
description: 'Build Type' | |
required: true | |
default: 'debug' | |
type: choice | |
options: | |
- debug | |
- release | |
groupTester: | |
description: 'Testers' | |
required: true | |
default: 'qa' | |
type: choice | |
options: | |
- all | |
- qa | |
- production | |
releaseNotes: | |
description: 'Release notes' | |
required: true | |
default: 'Update' | |
type: string | |
push: | |
branches: | |
- develop | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
generation: | |
runs-on: ubuntu-latest | |
environment: ${{ github.ref_name }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Set up Gradle cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties', '**/buildSrc/**/*.kt') }} | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
- name: Create file | |
run: cat /home/runner/work/MBCGroup/MBCGroup/app/google-services.json | base64 | |
- name: Putting data | |
env: | |
DATA: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
run: echo $DATA > /home/runner/work/MBCGroup/MBCGroup/app/google-services.json | |
- name: Configuration Local.properties | |
env: | |
SHARED_PREFERENCES_NAME: ${{ secrets.SHARED_PREFERENCES_NAME }} | |
BASE_URL: ${{ secrets.BASE_URL }} | |
BASE_URL_GQL: ${{ secrets.BASE_URL_GQL }} | |
CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
BUILD_TYPE_VALUE: | | |
if [[ ${{ inputs.buildType || 'debug' }} == "debug" ]]; then | |
"Debug" | |
else | |
"Release" | |
fi | |
APP_ID: | | |
if [[ ${{ inputs.buildType || 'debug' }} == "debug" ]]; then | |
${{secrets.APP_ID_DEBUG}} | |
else | |
${{secrets.APP_ID_RELEASE}} | |
fi | |
RELEASE_NOTE: | | |
if [[ "${{ inputs.releaseNotes }}" == "" ]]; then | |
cat release_notes.txt | |
else | |
${{inputs.releaseNotes}} | |
fi | |
run: | | |
echo "SHARED_PREFERENCES_NAME=$SHARED_PREFERENCES_NAME" >> local.properties | |
echo "BASE_URL=$BASE_URL" >> local.properties | |
echo "BASE_URL_GQL=$BASE_URL_GQL" >> local.properties | |
echo "CLIENT_ID=$CLIENT_ID" >> local.properties | |
echo "CLIENT_SECRET=$CLIENT_SECRET" >> local.properties | |
# - name: Execute validations | |
# run: ./gradlew executeValidations | |
- name: Build App | |
run: ./gradlew assemble${BUILD_TYPE^} | |
env: | |
DEBUG_KEY_PASSWORD: ${{ secrets.DEBUG_KEY_PASSWORD }} | |
- name: upload artifact to Firebase App Distribution | |
uses: wzieba/Firebase-Distribution-Github-Action@v1 | |
with: | |
appId: $APP_ID | |
serviceCredentialsFileContent: ${{ secrets.FIREBASE_TOKEN }} | |
groups: ${{ inputs.groupTester || 'qa' }} | |
releaseNotesFile: $RELEASE_NOTE | |
file: app/build/outputs/apk/${{ inputs.buildType || 'debug' }}/app-${{ inputs.buildType || 'debug' }}.apk | |
- name: Upload APK artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: app-${{ inputs.buildType || 'debug' }} | |
path: app/build/outputs/apk/${{ inputs.buildType || 'debug' }}/app-${{ inputs.buildType || 'debug' }}.apk |