Skip to content

feat: add hint function environment variable (#566) #78

feat: add hint function environment variable (#566)

feat: add hint function environment variable (#566) #78

name: deploy_api_dev
on:
workflow_dispatch:
push:
paths:
- "api/**"
- ".github/workflows/deploy_api_dev.yaml"
branches:
- main
env:
PROJECT_ID: io-crossword-dev
SERVICE: io-crossword-dev-api
REGION: us-central1
GAME_URL: "*"
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 }}"