variables: region: "asia-east1" image: node:lts-alpine cache: paths: - node_modules/ stages: - install - test - build - deploy install: stage: install script: - yarn install test1 lint: stage: test script: - yarn install - NODE_ENV=production yarn run lint test2 build: stage: test script: - yarn install - yarn run build build-staging: stage: build image: docker:latest services: - docker:dind before_script: - echo $CLOUDRUN_DEMO_KEY > ${HOME}/key.json - cat ${HOME}/key.json | docker login -u _json_key --password-stdin https://asia.gcr.io script: - 'echo -e "User-agent: *\nDisallow: /\n" > static/robots.txt' - docker build -t asia.gcr.io/finpo-demo/$CI_PROJECT_NAME:latest . - docker push asia.gcr.io/finpo-demo/$CI_PROJECT_NAME:latest only: - master deploy-staging: stage: deploy image: google/cloud-sdk:latest before_script: - echo $CLOUDRUN_DEMO_KEY > ${HOME}/key.json script: - gcloud auth activate-service-account --key-file ${HOME}/key.json - gcloud run deploy $CI_PROJECT_NAME --platform managed --region $region --project finpo-demo --image asia.gcr.io/finpo-demo/$CI_PROJECT_NAME:latest --allow-unauthenticated environment: name: staging only: - master build-production: stage: build image: docker:latest services: - docker:dind before_script: - echo $CLOUDRUN_PRODUCTION_KEY > ${HOME}/key.json - cat ${HOME}/key.json | docker login -u _json_key --password-stdin https://asia.gcr.io script: - docker build -t asia.gcr.io/finpo-production/$CI_PROJECT_NAME:latest . - docker push asia.gcr.io/finpo-production/$CI_PROJECT_NAME:latest only: - production deploy-production: stage: deploy image: google/cloud-sdk:latest before_script: - echo $CLOUDRUN_PRODUCTION_KEY > ${HOME}/key.json script: - gcloud auth activate-service-account --key-file ${HOME}/key.json - gcloud run deploy $CI_PROJECT_NAME --platform managed --region $region --project finpo-production --image asia.gcr.io/finpo-production/$CI_PROJECT_NAME:latest --allow-unauthenticated environment: name: production only: - production