Skip to content

Instantly share code, notes, and snippets.

@andrzj
Last active September 7, 2018 17:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrzj/7c1f49aa915205eee7e9204cd5b9762e to your computer and use it in GitHub Desktop.
Save andrzj/7c1f49aa915205eee7e9204cd5b9762e to your computer and use it in GitHub Desktop.
Gitlab CI - Google Cloud
variables:
GCP_PROJECT_ID: ****
GCLOUD_SERVICE_KEY: ****
NPM_TOKEN: ****
image: andrzj/gcloud-ci
cache:
untracked: true
key: "$CI_BUILD_REF_NAME"
paths:
- node_modules/
policy: pull # https://docs.gitlab.com/ee/ci/yaml/README.html#cache-policy
stages:
- setup
- test
- deploy
setup:
stage: setup
only:
- master
script:
- echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc
- npm install --only=production
test:
stage: test
script:
- npm test
deploy:
stage: deploy
only:
- master
dependencies:
- test
script:
- gcloud beta functions deploy $CI_PROJECT_NAME --runtime=nodejs8 --source=$CI_PROJECT_NAME --memory=256MB --timeout=60s --stage-bucket=**** --trigger-http
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment