Downscale #359
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: Action | Deploy to Production | |
on: pull_request | |
jobs: | |
deploy_search: | |
runs-on: ubuntu-latest | |
environment: production | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: '${{ secrets.SERVICE_ACCOUNT }}' | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v1' | |
- name: Set env vars | |
working-directory: packages/search | |
run: echo "$ENV_VARS" > .env | |
env: | |
ENV_VARS: ${{ secrets.ENV_VARS }} | |
# - name: Build image | |
# run: | | |
# cp packages/search/Dockerfile . | |
# gcloud builds submit --tag gcr.io/$GOOGLE_CLOUD_PROJECT/search | |
- name: Deploy | |
run: | | |
gcloud run deploy search \ | |
--image gcr.io/$GOOGLE_CLOUD_PROJECT/search \ | |
--min-instances=0 \ | |
--max-instances=10 \ | |
--allow-unauthenticated \ | |
--timeout=600 \ | |
--ingress=internal-and-cloud-load-balancing \ | |
--add-cloudsql-instances $GOOGLE_CLOUD_PROJECT:us-central1:buildcore \ | |
--region=us-central1 \ | |
deploy_functions: | |
runs-on: ubuntu-latest | |
environment: production | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- id: 'auth' | |
uses: 'google-github-actions/auth@v1' | |
with: | |
credentials_json: '${{ secrets.SERVICE_ACCOUNT }}' | |
- name: 'Set up Cloud SDK' | |
uses: 'google-github-actions/setup-gcloud@v1' | |
- name: Set env vars | |
working-directory: packages/functions | |
run: echo "$ENV_VARS" > .env | |
env: | |
ENV_VARS: ${{ secrets.ENV_VARS }} | |
- name: Build and deploy | |
run: | | |
npm run build:functions | |
npm run create-deploy-script | |
chmod 777 ./deploy.sh | |
./deploy.sh | |