diff --git a/.github/workflows/mobile-prod.yml b/.github/workflows/mobile-prod.yml index a634ea2c6..0cb11392b 100644 --- a/.github/workflows/mobile-prod.yml +++ b/.github/workflows/mobile-prod.yml @@ -14,6 +14,8 @@ jobs: deploy: runs-on: ubuntu-latest + environment: prod + permissions: contents: read @@ -52,3 +54,29 @@ jobs: - name: Publish update run: cd apps/mobile && eas update --auto + + - name: Decode Google Credentials + run: | + DECODED_GOOGLE_CREDENTIALS=$(echo '${{ secrets.GOOGLE_CREDENTIALS }}' | base64 --decode) + echo "DECODED_GOOGLE_CREDENTIALS=$DECODED_GOOGLE_CREDENTIALS" >> $GITHUB_ENV + echo "::add-mask::$DECODED_GOOGLE_CREDENTIALS" + ESCAPED_GOOGLE_CREDENTIALS=$(echo "$DECODED_GOOGLE_CREDENTIALS" | sed ':a;N;$!ba;s/\n/\\n/g' | sed 's/"/\\"/g') + ESCAPED_GOOGLE_CREDENTIALS=$(echo $ESCAPED_GOOGLE_CREDENTIALS | sed 's/\\n/\\\\n/g') + echo "ESCAPED_GOOGLE_CREDENTIALS=$ESCAPED_GOOGLE_CREDENTIALS" >> $GITHUB_ENV + echo "::add-mask::$ESCAPED_GOOGLE_CREDENTIALS" + + # See https://github.com/ever-co/ever-teams-boards-store/blob/develop/.github/workflows/deploy.yml + + - name: "Authenticate to Google Cloud" + uses: "google-github-actions/auth@v1" + with: + credentials_json: ${{ env.DECODED_GOOGLE_CREDENTIALS }} + + # Install gcloud, `setup-gcloud` automatically picks up authentication from `auth`. + - name: "Set up Cloud SDK" + uses: "google-github-actions/setup-gcloud@v1" + with: + project_id: "ever-teams-399720" + + - name: Upload to Play Store Console + run: cd apps/mobile && eas submit -p android --latest --key ${{ secrets.GOOGLE_CREDENTIALS }}