2019-01-18 20:53:09 +00:00
|
|
|
version: 2
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
docker:
|
2021-03-31 16:09:34 +00:00
|
|
|
- image: cimg/node:14.16
|
2019-01-18 20:53:09 +00:00
|
|
|
environment:
|
2021-02-27 04:54:41 +00:00
|
|
|
HUGO_VERSION: "0.81.0"
|
2020-09-02 20:18:46 +00:00
|
|
|
S3DEPLOY_VERSION: "2.3.5"
|
2019-01-18 20:53:09 +00:00
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore_cache:
|
|
|
|
keys:
|
2020-04-22 17:36:46 +00:00
|
|
|
- install-{{ .Environment.CACHE_VERSION }}-{{ checksum ".circleci/config.yml" }}
|
|
|
|
- install-{{ .Environment.CACHE_VERSION }}-
|
2019-01-18 20:53:09 +00:00
|
|
|
- run:
|
|
|
|
name: Make bin folder
|
|
|
|
command: mkdir -p $HOME/bin
|
|
|
|
- run:
|
|
|
|
name: Install Hugo
|
2019-01-18 21:21:32 +00:00
|
|
|
command: ./deploy/ci-install-hugo.sh
|
2019-01-18 20:53:09 +00:00
|
|
|
- run:
|
|
|
|
name: Install s3deploy
|
2019-01-18 21:21:32 +00:00
|
|
|
command: ./deploy/ci-install-s3deploy.sh
|
2020-04-22 17:45:47 +00:00
|
|
|
- run:
|
2020-04-22 18:18:44 +00:00
|
|
|
name: Install NodeJS dependencies
|
2021-03-31 17:10:10 +00:00
|
|
|
command: sudo yarn global add postcss-cli@8.3.0 autoprefixer@9.8.6 redoc-cli@0.9.12
|
2019-09-30 16:00:22 +00:00
|
|
|
- run:
|
|
|
|
name: Generate API documentation
|
2019-09-30 17:05:03 +00:00
|
|
|
command: cd api-docs && bash generate-api-docs.sh
|
2019-01-18 20:53:09 +00:00
|
|
|
- save_cache:
|
2020-04-22 17:46:26 +00:00
|
|
|
key: install-{{ .Environment.CACHE_VERSION }}-{{ checksum ".circleci/config.yml" }}
|
2019-01-18 20:53:09 +00:00
|
|
|
paths:
|
|
|
|
- /home/circleci/bin
|
|
|
|
- run:
|
|
|
|
name: Hugo Build
|
2019-03-22 21:14:03 +00:00
|
|
|
command: $HOME/bin/hugo -v --minify --destination workspace/public
|
2019-01-18 20:53:09 +00:00
|
|
|
- persist_to_workspace:
|
|
|
|
root: workspace
|
|
|
|
paths:
|
|
|
|
- public
|
|
|
|
|
|
|
|
deploy:
|
|
|
|
docker:
|
|
|
|
- image: circleci/golang:latest
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
- restore_cache:
|
|
|
|
keys:
|
2020-04-22 17:46:26 +00:00
|
|
|
- install-{{ .Environment.CACHE_VERSION }}-{{ checksum ".circleci/config.yml" }}
|
|
|
|
- install-{{ .Environment.CACHE_VERSION }}-
|
2019-01-18 20:53:09 +00:00
|
|
|
- attach_workspace:
|
|
|
|
at: workspace
|
|
|
|
- run:
|
|
|
|
name: Deploy to S3
|
2019-01-24 01:03:06 +00:00
|
|
|
command: $HOME/bin/s3deploy -source=workspace/public/ -bucket=$BUCKET -region=$REGION -distribution-id=$CF_DISTRIBUTION_ID
|
2019-02-08 21:08:07 +00:00
|
|
|
- run:
|
|
|
|
name: Post in Slack
|
2019-02-08 21:13:13 +00:00
|
|
|
command: >
|
2020-09-02 23:55:33 +00:00
|
|
|
export COMMIT_INFO="$(git log -1 --format='%n>>>%s%n%b%n_<https://github.com/influxdata/docs-v2/commit/%H|Commit %h> - by %an_')"; curl -X POST --data-urlencode "payload={\"username\": \"Doc the Docs Bot\", \"text\": \"The docs successfully deployed! :greeny_peeny:\n\n $COMMIT_INFO\", \"icon_emoji\": \":doc_green:\"}" $SLACK_DOCS_WEBHOOK_URL
|
2019-02-08 21:08:07 +00:00
|
|
|
when: on_success
|
2019-01-18 20:53:09 +00:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
|
|
|
build:
|
|
|
|
jobs:
|
|
|
|
- build
|
|
|
|
- deploy:
|
|
|
|
requires:
|
|
|
|
- build
|
|
|
|
filters:
|
|
|
|
branches:
|
|
|
|
only:
|
2019-01-18 21:05:06 +00:00
|
|
|
- master
|