Last active
January 12, 2020 14:55
-
-
Save avdoshenkov/0fcf6818b571a31e174ed905492a402d to your computer and use it in GitHub Desktop.
Gitlab CI deploy config for Gatsby JS site and Yandex Object Storage
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
image: node:latest | |
stages: | |
- build | |
- deploy | |
variables: | |
BUCKET_NAME: bucket-name | |
cache: | |
paths: | |
- node_modules/ | |
buildGatsby: | |
stage: build | |
script: | |
- npm install | |
- ./node_modules/.bin/gatsby build | |
artifacts: | |
paths: | |
- public | |
only: | |
- master | |
deploys3: | |
image: "python:3.6.6" # We use python because there is a well-working AWS Sdk | |
stage: deploy | |
dependencies: | |
- buildGatsby | |
before_script: | |
- pip install awscli # Install the SDK | |
script: | |
- aws --endpoint-url=https://storage.yandexcloud.net s3 cp public s3://${BUCKET_NAME} --recursive | |
environment: | |
name: 's3-deploy' | |
url: http://${BUCKET_NAME}.website.yandexcloud.net # This is the url of the bucket we saved before | |
# source: https://www.alvareznavarro.es/blog/2018/6/how-to-deploy-a-gatsby-website-to-amazon-s3-using-gitlab-ci/ | |
# Yandex Object Storage is compatible with Amazon S3 API |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment