docs-v2/.circleci/config.yml

76 lines
2.4 KiB
YAML
Raw Normal View History

2019-01-18 20:53:09 +00:00
version: 2
jobs:
build:
docker:
2020-04-22 17:31:58 +00:00
- image: circleci/node:erbium
2019-01-18 20:53:09 +00:00
environment:
HUGO_VERSION: "0.59.1"
S3DEPLOY_VERSION: "2.3.2"
2019-01-18 20:53:09 +00:00
steps:
- checkout
- restore_cache:
keys:
- 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
command: ./deploy/ci-install-hugo.sh
2019-01-18 20:53:09 +00:00
- run:
name: Install s3deploy
command: ./deploy/ci-install-s3deploy.sh
2019-01-18 21:26:07 +00:00
- run:
name: TMP Flush cache
command: sudo npm cache clean --force
2019-01-18 21:26:07 +00:00
name: Install NPM dependencies
command: sudo npm i -g postcss-cli autoprefixer redoc-cli
- 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:
key: install-v1-{{ checksum ".circleci/config.yml" }}
paths:
- /home/circleci/bin
- run:
name: Hugo Build
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:
- install-v1-{{ checksum ".circleci/config.yml" }}
- install-v1-
- attach_workspace:
at: workspace
- run:
name: Deploy to S3
command: $HOME/bin/s3deploy -source=workspace/public/ -bucket=$BUCKET -region=$REGION -distribution-id=$CF_DISTRIBUTION_ID
- run:
name: Post in Slack
2019-02-08 21:13:13 +00:00
command: >
2019-02-08 21:43:34 +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 InfluxDB v2 docs successfully deployed! :greeny_peeny:\n\n $COMMIT_INFO\", \"icon_emoji\": \":doc_green:\"}" $SLACK_DOCS_WEBHOOK_URL
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