Flipcash Build and Deploy #95
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: Flipcash Build and Deploy | |
| env: | |
| main_project_module: apps:flipcash:app | |
| playstore_name: Flipcash | |
| # Cancel in-progress workflow runs if a job fails | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.inputs.track }}-${{ github.event.inputs.release_status }} | |
| cancel-in-progress: true | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| track: | |
| description: 'Define PlayStore track name' | |
| required: true | |
| default: 'internal' | |
| type: choice | |
| options: | |
| - internal | |
| - alpha | |
| - beta | |
| - production | |
| release_status: | |
| description: 'Status of the release' | |
| required: true | |
| type: choice | |
| default: 'completed' | |
| options: | |
| - completed | |
| - draft | |
| - inProgress | |
| - halted | |
| jobs: | |
| setup: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| google_services_json: ${{ steps.google_services_json_file.outputs.filePath }} | |
| service_account_json: ${{ steps.service_account_json_file.outputs.filePath }} | |
| signing_key: ${{ steps.signing_key.outputs.filePath }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Java env | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '17' | |
| distribution: 'corretto' | |
| cache: 'gradle' | |
| - name: Setup Ruby env | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 2.7.2 | |
| bundler-cache: true | |
| - name: Decode Google Services JSON file | |
| uses: timheuer/base64-to-file@v1 | |
| id: google_services_json_file | |
| with: | |
| fileName: google-services.json | |
| fileDir: ./apps/flipcash/app/src | |
| encodedString: ${{ secrets.FLIPCASH_GOOGLE_SERVICES_JSON }} | |
| - name: Decode Service Account Key JSON file | |
| uses: timheuer/base64-to-file@v1 | |
| id: service_account_json_file | |
| with: | |
| fileName: serviceAccount.json | |
| encodedString: ${{ secrets.FLIPCASH_SERVICE_ACCOUNT_KEY_JSON }} | |
| - name: Decode Upload Key Store file into location 1 | |
| uses: timheuer/base64-to-file@v1 | |
| id: signing_key | |
| with: | |
| fileName: key | |
| fileDir: ./key | |
| encodedString: ${{ secrets.UPLOAD_KEY_STORE }} | |
| - name: Decode Upload Key Store file into location 2 | |
| uses: timheuer/base64-to-file@v1 | |
| with: | |
| fileName: key | |
| fileDir: ./apps/flipcash/app/key | |
| encodedString: ${{ secrets.UPLOAD_KEY_STORE }} | |
| - name: Setup BugSnag API Key | |
| run: echo BUGSNAG_API_KEY=\"${{ secrets.FLIPCASH_BUGSNAG_API_KEY }}\" > ./local.properties | |
| - name: Setup Google Cloud Project Number | |
| run: echo GOOGLE_CLOUD_PROJECT_NUMBER=${{ secrets.GOOGLE_CLOUD_PROJECT_NUMBER }} >> ./local.properties | |
| - name: Setup Mixpanel API Key | |
| run: echo MIXPANEL_API_KEY=\"${{ secrets.FLIPCASH_MIXPANEL_API_KEY }}\" >> ./local.properties | |
| - name: Cache Gradle | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties', '**/gradle/wrapper/*') }} | |
| restore-keys: gradle- | |
| - name: Upload Setup Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: setup-files | |
| path: | | |
| ${{ steps.google_services_json_file.outputs.filePath }} | |
| ${{ steps.service_account_json_file.outputs.filePath }} | |
| ${{ steps.signing_key.outputs.filePath }} | |
| code-android-app/apps/flipcash/app/key/key | |
| code-android-app/local.properties | |
| if-no-files-found: error | |
| tests: | |
| needs: setup | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Ruby env | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 2.7.2 | |
| bundler-cache: true | |
| - name: Restore Gradle Cache | |
| uses: actions/cache/restore@v3 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties', '**/gradle/wrapper/*') }} | |
| restore-keys: gradle- | |
| - name: Download Setup Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: setup-files | |
| path: . | |
| - name: Run tests | |
| run: bundle exec fastlane android flipcash_tests | |
| build: | |
| needs: setup | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Ruby env | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 2.7.2 | |
| bundler-cache: true | |
| - name: Restore Gradle Cache | |
| uses: actions/cache/restore@v3 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle.properties', '**/gradle/wrapper/*') }} | |
| restore-keys: gradle- | |
| - name: Download Setup Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: setup-files | |
| path: . | |
| - name: Build Android release | |
| run: bundle exec fastlane android build_flipcash | |
| env: | |
| STORE_FILE: ${{ needs.setup.outputs.signing_key }} | |
| STORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
| KEY_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} | |
| - name: Upload Build Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-assets | |
| path: | | |
| ${{ github.workspace }}/artifacts/*.aab | |
| ${{ github.workspace }}/artifacts/*.txt | |
| if-no-files-found: error | |
| deploy: | |
| needs: [tests, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Ruby env | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 2.7.2 | |
| bundler-cache: true | |
| - name: Download Build Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: build-assets | |
| path: artifacts/ | |
| - name: Deploy to Play Store | |
| run: bundle exec fastlane android deploy_to_play_store | |
| env: | |
| SERVICE_ACCOUNT_KEY_JSON: ./code-android-app/serviceAccount.json | |
| PACKAGE_NAME: com.flipcash.android.app | |
| PLAYSTORE_TRACK: ${{ github.event.inputs.track }} | |
| RELEASE_STATUS: ${{ github.event.inputs.release_status }} |