deploy_api_staging #22
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: deploy_api_staging | |
on: workflow_dispatch | |
env: | |
PROJECT_ID: io-crossword-dev | |
SERVICE: io-crossword-staging-api | |
REGION: us-central1 | |
GAME_URL: https://stg-e7b2896c65fabc0480edc6c0e.web.app | |
INITIALS_BLACKLIST_ID: T1ilfCwjDpLS7iaFzenA | |
FB_STORAGE_BUCKET: io-crossword-dev.appspot.com | |
HINT_FUNCTION_URL: gethintkit-sea6y22h5q-uc.a.run.app | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dart-lang/setup-dart@v1 | |
with: | |
sdk: stable | |
- name: Install Dart Frog | |
run: dart pub global activate dart_frog_cli | |
- name: Create Dev Build | |
working-directory: ./api | |
run: dart_frog build | |
- name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v2 | |
with: | |
credentials_json: ${{ secrets.CLOUD_RUN_DEV_SERVICE_ACCOUNT }} | |
- name: Authorize Docker push | |
run: gcloud auth configure-docker | |
- name: Build and Push Container | |
run: |- | |
cp api/Dockerfile api/build/Dockerfile | |
docker build -t gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }} api/build | |
docker push gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }} | |
- name: Deploy to Cloud Run | |
id: deploy | |
uses: google-github-actions/deploy-cloudrun@v2 | |
with: | |
service: ${{ env.SERVICE }} | |
image: gcr.io/${{ env.PROJECT_ID }}/${{ env.SERVICE }}:${{ github.sha }} | |
region: ${{ env.REGION }} | |
env_vars: | | |
FB_APP_ID=${{ env.PROJECT_ID }} | |
GAME_URL=${{ env.GAME_URL }} | |
INITIALS_BLACKLIST_ID=${{ env.INITIALS_BLACKLIST_ID }} | |
FB_STORAGE_BUCKET=${{ env.FB_STORAGE_BUCKET }} | |
HINT_FUNCTION_URL=${{ env.HINT_FUNCTION_URL }} | |
- name: Show Output | |
run: echo ${{ steps.deploy.outputs.url }} | |
- name: Ping | |
run: curl "${{ steps.deploy.outputs.url }}" |