Last active
July 2, 2018 03:15
-
-
Save TakuyaHarayama/447318ad453b3673f81feed4b7feaf75 to your computer and use it in GitHub Desktop.
CircleCIからS3にホスティングする設定ファイル。YOUR-PROJECTにはプロジェクト名を入れてください。事前にS3のbucketを作成して、CircleCIにアップロード用のIAMのキーやS3のホスティングの設定しておく必要があります。
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
version: 2 | |
workspace_root: &workspace_root | |
~/YOUR-PROJECT/docs | |
defaults: &defaults | |
docker: | |
- image: circleci/node:8 | |
working_directory: *workspace_root | |
attach_workspace: &attach_workspace | |
attach_workspace: | |
at: *workspace_root | |
jobs: | |
docs: | |
<<: *defaults | |
steps: | |
- checkout | |
- run: | |
name: System information | |
command: | | |
echo "Node $(node -v)" | |
echo "Yarn v$(yarn --version)" | |
# Download and cache dependencies | |
- restore_cache: | |
keys: | |
- v1-dependencies-{{ checksum "package.json" }} | |
# fallback to using the latest cache if no exact match is found | |
- v1-dependencies- | |
- run: | |
name: Install dependencies | |
command: | | |
sudo apt-get install graphviz | |
sudo apt-get install default-jre | |
npm install | |
- save_cache: | |
paths: | |
- node_modules | |
key: v1-dependencies-{{ checksum "package.json" }} | |
- run: | |
name: Create HTML from markdown via gitbook | |
command: npm run build | |
- persist_to_workspace: | |
root: *workspace_root | |
paths: | |
- _book | |
deploy_s3: | |
<<: *defaults | |
steps: | |
- <<: *attach_workspace | |
- run: | |
name: Install dependencies | |
command: sudo apt-get -y -qq install awscli | |
- run: | |
name: Deploy to S3 if tests pass and branch is Master | |
command: aws s3 sync _book s3://YOUR-PROJECT-docs --delete | |
workflows: | |
version: 2 | |
workflows: | |
jobs: | |
- docs | |
- deploy_s3: | |
requires: | |
- docs | |
filters: | |
branches: | |
only: master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment