|
| 1 | +name: Flipcash2 Build and Deploy |
| 2 | + |
| 3 | +env: |
| 4 | + # The name of the main module repository |
| 5 | + main_project_module: apps:flipcash:app2 |
| 6 | + |
| 7 | + # The name of the Play Store |
| 8 | + playstore_name: Flipcash |
| 9 | + |
| 10 | +on: |
| 11 | + # Allows you to run this workflow manually from the Actions tab |
| 12 | + workflow_dispatch: |
| 13 | + inputs: |
| 14 | + track: |
| 15 | + description: 'Define PlayStore track name' |
| 16 | + required: true |
| 17 | + default: 'internal' |
| 18 | + type: choice |
| 19 | + options: |
| 20 | + - internal |
| 21 | + - alpha |
| 22 | + - beta |
| 23 | + - production |
| 24 | + |
| 25 | + release_status: |
| 26 | + description: 'Status of the release' |
| 27 | + required: true |
| 28 | + type: choice |
| 29 | + default: 'completed' |
| 30 | + options: |
| 31 | + - completed |
| 32 | + - draft |
| 33 | + - inProgress |
| 34 | + - halted |
| 35 | + |
| 36 | +jobs: |
| 37 | + deploy: |
| 38 | + runs-on: ubuntu-latest |
| 39 | + |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v4 |
| 42 | + with: |
| 43 | + fetch-depth: 0 |
| 44 | + |
| 45 | + - name: Setup Java env |
| 46 | + uses: actions/setup-java@v3 |
| 47 | + with: |
| 48 | + java-version: '21' |
| 49 | + distribution: 'corretto' |
| 50 | + cache: 'gradle' |
| 51 | + |
| 52 | + - name: Setup Ruby env |
| 53 | + uses: ruby/setup-ruby@v1 |
| 54 | + with: |
| 55 | + ruby-version: 2.7.2 |
| 56 | + bundler-cache: true |
| 57 | + |
| 58 | + - name: Decode Google Services JSON file |
| 59 | + uses: timheuer/base64-to-file@v1 |
| 60 | + id: google_services_json_file |
| 61 | + with: |
| 62 | + fileName: google-services.json |
| 63 | + fileDir: ./apps/flipcash/app2/src |
| 64 | + encodedString: ${{ secrets.FLIPCASH2_GOOGLE_SERVICES }} |
| 65 | + |
| 66 | + - name: Decode Service Account Key JSON file |
| 67 | + uses: timheuer/base64-to-file@v1 |
| 68 | + id: service_account_json_file |
| 69 | + with: |
| 70 | + fileName: serviceAccount.json |
| 71 | + encodedString: ${{ secrets.FLIPCASH_SERVICE_ACCOUNT_KEY_JSON }} |
| 72 | + |
| 73 | + - name: Decode Upload Key Store file into location 1 |
| 74 | + uses: timheuer/base64-to-file@v1 |
| 75 | + id: signing_key |
| 76 | + with: |
| 77 | + fileName: key |
| 78 | + fileDir: ./key |
| 79 | + encodedString: ${{ secrets.UPLOAD_KEY_STORE }} |
| 80 | + |
| 81 | + - name: Decode Upload Key Store file into location 2 |
| 82 | + uses: timheuer/base64-to-file@v1 |
| 83 | + with: |
| 84 | + fileName: key |
| 85 | + fileDir: ./apps/flipcash/app2/key |
| 86 | + encodedString: ${{ secrets.UPLOAD_KEY_STORE }} |
| 87 | + |
| 88 | + - name: Setup BugSnag API Key |
| 89 | + run: echo BUGSNAG_API_KEY=\"${{ secrets.FLIPCASH_BUGSNAG_API_KEY }}\" > ./local.properties |
| 90 | + |
| 91 | + - name: Setup Google Cloud Project Number |
| 92 | + run: echo GOOGLE_CLOUD_PROJECT_NUMBER=${{ secrets.GOOGLE_CLOUD_PROJECT_NUMBER }} >> ./local.properties |
| 93 | + |
| 94 | + - name: Setup Mixpanel API Key |
| 95 | + run: echo MIXPANEL_API_KEY=\"${{ secrets.FLIPCASH_MIXPANEL_API_KEY }}\" >> ./local.properties |
| 96 | + |
| 97 | + - name: Run tests |
| 98 | + run: bundle exec fastlane android flipcash_tests |
| 99 | + |
| 100 | + - name: Build & deploy Android release |
| 101 | + run: bundle exec fastlane android deploy_flipcash |
| 102 | + env: |
| 103 | + STORE_FILE: ${{ steps.signing_key.outputs.filePath }} |
| 104 | + STORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} |
| 105 | + KEY_ALIAS: ${{ secrets.KEY_ALIAS}} |
| 106 | + KEY_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }} |
| 107 | + SERVICE_ACCOUNT_KEY_JSON: ${{ steps.service_account_json_file.outputs.filePath }} |
| 108 | + PACKAGE_NAME: com.flipcash.android.app |
| 109 | + PLAYSTORE_TRACK: ${{ github.event.inputs.track }} |
| 110 | + RELEASE_STATUS: ${{ github.event.inputs.release_status }} |
| 111 | + |
| 112 | + - name: Upload build artifacts |
| 113 | + uses: actions/upload-artifact@v4 |
| 114 | + if: always() |
| 115 | + with: |
| 116 | + name: assets |
| 117 | + path: | |
| 118 | + ${{ github.workspace }}/apps/flipcash/app2/build/outputs/bundle/release |
| 119 | + ${{ github.workspace }}/apps/flipcash/app2/build/outputs/apk/release |
0 commit comments