HOTFIX: CI/CD app config #10
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 to Google App Engine | |
on: | |
push: | |
branches: | |
- main # Trigger workflow | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
# Set env variables based on branch | |
- name: Set Environment Variables for Production | |
if: github.ref == 'refs/heads/main' | |
run: | | |
echo "ENV_TYPE=production" >> $GITHUB_ENV | |
echo "PROJECT_ID=kai-ai-f63c8" >> $GITHUB_ENV | |
- name: GCP Auth | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: ${{ secrets.PRODUCTION_CREDENTIALS_JSON }} | |
# Dynamically Update app.yaml | |
- name: Update app.yaml | |
run: | | |
echo "" >> app/app.yaml | |
echo "env_variables:" >> app/app.yaml | |
echo " ENV_TYPE: '${{ env.ENV_TYPE }}'" >> app/app.yaml | |
echo " PROJECT_ID: '${{ env.PROJECT_ID }}'" >> app/app.yaml | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v1' | |
with: | |
version: '>= 363.0.0' | |
- name: Deploy To App Engine (Production) | |
if: github.ref == 'refs/heads/main' | |
uses: 'google-github-actions/[email protected]' | |
with: | |
deliverables: app/app.yaml | |
version: v1 |