diff options
| author | Jan Tuomi <jans.tuomi@gmail.com> | 2021-07-02 16:02:25 +0300 |
|---|---|---|
| committer | Jan Tuomi <jans.tuomi@gmail.com> | 2021-07-02 16:02:25 +0300 |
| commit | 0f1fea2773188605f621d7f853f739df8cdbe4ad (patch) | |
| tree | 03940c27f74af971b825c28c4c2309f03cac7472 /.github/workflows/tomi.science.yml | |
| parent | 5c510f80ef01ba979be5d7cd751be65a2bdb70cd (diff) | |
Add frontend deploy to workflow2021.07_04
Diffstat (limited to '.github/workflows/tomi.science.yml')
| -rw-r--r-- | .github/workflows/tomi.science.yml | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/.github/workflows/tomi.science.yml b/.github/workflows/tomi.science.yml index 50267b6..c8f419d 100644 --- a/.github/workflows/tomi.science.yml +++ b/.github/workflows/tomi.science.yml @@ -15,7 +15,9 @@ env: GCR_VPC_CONNECTOR: connector1 # Env vars comma separated GCR_ENV_VARS: "^&^FRONTEND_URL=https://tomi.science\ - &POSTGRES_CONNECTION_STRING=postgresql://tomi_science_user:${{ secrets.DATABASE_PASSWORD }}@10.24.240.3/tomi_science" + &POSTGRES_CONNECTION_STRING=postgresql://tomi_science_user:${{ secrets.DATABASE_PASSWORD }}@10.24.240.3/tomi_science\ + &NEXT_PUBLIC_BACKEND_URL=https://api.tomi.science" + GCS_BUCKET: gs://tomi_science_frontend jobs: website: @@ -65,16 +67,16 @@ jobs: restore-keys: | tomi-science-docker-cache- - # Build the Docker image - - name: Build image + # Build the backend Docker image + - name: Build backend image run: docker build -t ${IMAGE_AND_TAG} backend - # Push the Docker image to Google Container Registry - - name: Push image to registry + # Push the backend Docker image to Google Container Registry + - name: Push backend image to registry run: docker push ${IMAGE_AND_TAG} - # Deploy to Google Cloud Run - - name: Deploy to Cloud Run + # Deploy backend to Google Cloud Run + - name: Deploy backend to Cloud Run run: |- gcloud run deploy ${GCR_SERVICE} \ --region=${GCR_REGION} \ @@ -84,3 +86,12 @@ jobs: --vpc-connector=${GCR_VPC_CONNECTOR} \ --set-env-vars=${GCR_ENV_VARS} \ --image=${IMAGE_AND_TAG} + + # Build frontend + - name: Build frontend + run: cd frontend && npm run build && npm run export + + # Deploy frontend to GCS + - name: Deploy frontend to GCS + run: |- + gsutil -h "Cache-Control: no-store, max-age=0" cp -r out/* ${{ env.GCS_BUCKET }} |
