forked from influxdata/docs-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
76 lines (73 loc) · 2.49 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
version: 2
jobs:
build:
docker:
- image: cimg/node:14.16
environment:
HUGO_VERSION: "0.81.0"
S3DEPLOY_VERSION: "2.3.5"
# From https://github.com/bep/s3deploy/releases
S3DEPLOY_VERSION_HASH: "95de91ed207ba32abd0df71f9681c1ede952f8358f3510b980b02550254c941a"
steps:
- checkout
- restore_cache:
keys:
- install-{{ .Environment.CACHE_VERSION }}-{{ checksum ".circleci/config.yml" }}
- install-{{ .Environment.CACHE_VERSION }}-
- run:
name: Make bin folder
command: mkdir -p $HOME/bin
- run:
name: Install s3deploy
command: ./deploy/ci-install-s3deploy.sh
- run:
name: Install NodeJS dependencies
command: yarn install
- run:
name: Install API documentation dependencies
command: cd api-docs && yarn install
- run:
name: Generate API documentation
command: cd api-docs && bash generate-api-docs.sh
- save_cache:
key: install-{{ .Environment.CACHE_VERSION }}-{{ checksum ".circleci/config.yml" }}
paths:
- /home/circleci/bin
- run:
name: Hugo Build
command: npx hugo -v --minify --destination workspace/public
- persist_to_workspace:
root: workspace
paths:
- public
deploy:
docker:
- image: circleci/golang:latest
steps:
- checkout
- restore_cache:
keys:
- install-{{ .Environment.CACHE_VERSION }}-{{ checksum ".circleci/config.yml" }}
- install-{{ .Environment.CACHE_VERSION }}-
- 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
command: >
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
when: on_success
workflows:
version: 2
build:
jobs:
- build
- deploy:
requires:
- build
filters:
branches:
only:
- master