Skip to content

Instantly share code, notes, and snippets.

@jamesasu
Last active December 5, 2023 06:03
Show Gist options
  • Save jamesasu/a1c3e18638970563ceb8e925d56e91cf to your computer and use it in GitHub Desktop.
Save jamesasu/a1c3e18638970563ceb8e925d56e91cf to your computer and use it in GitHub Desktop.
Build a clientside project and deploy to Google Cloud Storage
stages:
- build
- test
- deploy
variables:
NODE_ENV: production
build:
stage: build
image: node:21
script:
- yarn install
- yarn run build
artifacts:
paths:
- dist
expire_in: 12 hrs
when: on_success
test:
stage: test
image: node:21
needs:
- build
script:
- yarn run test
deploy:
stage: deploy
image: gcr.io/google.com/cloudsdktool/google-cloud-cli:slim
needs:
- build
- test
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
when: on_success
script:
- gcloud auth activate-service-account --key-file=$GOOGLE_APPLICATION_CREDENTIALS
- gcloud storage cp dist/* gs://$GOOGLE_STORAGE_BUCKET/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment