Last active
December 15, 2023 12:27
-
-
Save woutrbe/3dad6d4c39c78d2956e9ae0a7a309112 to your computer and use it in GitHub Desktop.
Deploy to Google Cloud Bucket from Gitlab CI/CD
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
build app: | |
image: node:6 | |
stage: build | |
artifacts: | |
paths: | |
- public | |
script: | |
- npm install | |
- npm run build | |
# Your next stage won't have access to these files again, so copy it to a public directory | |
- mv dist public | |
deploy app: | |
only: | |
- master | |
dependencies: | |
- build app | |
stage: deploy | |
image: docker:latest | |
script: | |
# Install CA certs, openssl to https downloads, python for gcloud sdk | |
- apk add --update make ca-certificates openssl python | |
- update-ca-certificates | |
# Download and install Google Cloud SDK | |
- wget https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.tar.gz | |
- tar zxvf google-cloud-sdk.tar.gz && ./google-cloud-sdk/install.sh --usage-reporting=false --path-update=true | |
- PATH="google-cloud-sdk/bin:${PATH}" | |
- gcloud --quiet components update | |
- echo $GCP_SERVICE_KEY > ${HOME}/gcloud-service-key.json | |
- gcloud auth activate-service-account --key-file ${HOME}/gcloud-service-key.json | |
- gcloud config set project $GCP_PROJECT_ID | |
- gsutil -m cp -R public/* gs://timber-client-app/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment