Merge pull request #47 from radicalxdev/STAGING #24
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 with env variables | |
run: | | |
echo "" >> app.yaml | |
echo "env_variables:" >> app.yaml | |
echo " ENV_TYPE: '${{ env.ENV_TYPE }}'" >> app.yaml | |
echo " PROJECT_ID: '${{ env.PROJECT_ID }}'" >> app.yaml | |
echo " GOOGLE_API_KEY: '${{ secrets.GOOGLE_API_KEY }}'" >> app.yaml | |
echo " PYTHONPATH: 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.yaml | |
version: v1 |