Merge pull request #588 from MadridSquad/refactor/season-Card-padding #282
This file contains hidden or 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: Firebase CD - Distribute APK | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - main | |
| - refactor/cd-signed-apk | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Cache Gradle | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| gradle-${{ runner.os }}- | |
| - name: Make gradlew executable | |
| run: chmod +x ./gradlew | |
| - name: Create google-services.json | |
| env: | |
| GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
| run: | | |
| mkdir -p app/ | |
| echo "$GOOGLE_SERVICES_JSON" | base64 -d > app/google-services.json | |
| shell: bash | |
| - name: Create secret.properties | |
| env: | |
| API_KEY: ${{ secrets.API_KEY }} | |
| BASE_URL: ${{ secrets.BASE_URL }} | |
| run: | | |
| echo "API_KEY = \"$API_KEY\"" > secret.properties | |
| echo "BASE_URL = \"$BASE_URL\"" >> secret.properties | |
| - name: Create Android Keystore file | |
| env: | |
| KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} | |
| run: | | |
| echo "$KEYSTORE_BASE64" | base64 --decode > keystore.jks | |
| echo "Created keystore file" | |
| - name: Create key.properties file | |
| env: | |
| KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
| run: | | |
| echo "storeFile=../keystore.jks" > key.properties | |
| echo "storePassword=$KEYSTORE_PASSWORD" >> key.properties | |
| echo "keyAlias=$KEY_ALIAS" >> key.properties | |
| echo "keyPassword=$KEY_PASSWORD" >> key.properties | |
| echo "Created key.properties file" | |
| - name: Build Signed Release APK | |
| run: ./gradlew assembleRelease --build-cache -x test -x lint | |
| - name: Ensure APK is generated | |
| run: ls -l app/build/outputs/apk/release/app-release.apk || { echo "APK not generated"; exit 1; } | |
| - name: Extract Release Notes | |
| id: release_notes | |
| run: | | |
| COMMIT_MSG=$(git log -1 --pretty=%B | sed 's/"/\\"/g' | tr -d '\n') | |
| TRUNCATED_MSG="${COMMIT_MSG:0:500}" | |
| echo "$TRUNCATED_MSG" > release_notes.txt | |
| echo "notes=$TRUNCATED_MSG" >> $GITHUB_OUTPUT | |
| echo "Release notes: $TRUNCATED_MSG" | |
| - name: Install Firebase CLI | |
| run: npm install -g firebase-tools | |
| - name: Decode Firebase service account | |
| env: | |
| FIREBASE_SERVICE_ACCOUNT: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }} | |
| run: echo "$FIREBASE_SERVICE_ACCOUNT" | base64 --decode > "${{ github.workspace }}/firebase-service-account.json" | |
| - name: Set GOOGLE_APPLICATION_CREDENTIALS | |
| run: echo "GOOGLE_APPLICATION_CREDENTIALS=${{ github.workspace }}/firebase-service-account.json" >> $GITHUB_ENV | |
| - name: Upload APK to Firebase App Distribution | |
| run: | | |
| firebase appdistribution:distribute \ | |
| app/build/outputs/apk/release/app-release.apk \ | |
| --app "1:1038392982530:android:86b7c8565bb5aec276bb1b" \ | |
| --groups "release-testers" \ | |
| --release-notes-file release_notes.txt |