Skip to content

Instantly share code, notes, and snippets.

@avdoshenkov
Last active January 12, 2020 14:55
Show Gist options
  • Save avdoshenkov/0fcf6818b571a31e174ed905492a402d to your computer and use it in GitHub Desktop.
Save avdoshenkov/0fcf6818b571a31e174ed905492a402d to your computer and use it in GitHub Desktop.
Gitlab CI deploy config for Gatsby JS site and Yandex Object Storage
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