82 lines
2.7 KiB
YAML
82 lines
2.7 KiB
YAML
version: 2
|
|
jobs:
|
|
build:
|
|
docker:
|
|
- image: cimg/node:20.12.1
|
|
environment:
|
|
S3DEPLOY_VERSION: "2.11.0"
|
|
# From https://github.com/bep/s3deploy/releases
|
|
S3DEPLOY_VERSION_HASH: "d3566a6a56735ea5710cf22c35f8f411164e6efc22ded98743a1d7a5a21c740e"
|
|
|
|
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
|
|
- run:
|
|
name: Inject Flux stdlib frontmatter
|
|
command: node ./flux-build-scripts/inject-flux-stdlib-frontmatter.js
|
|
- run:
|
|
name: Update Flux/InfluxDB versions
|
|
command: node ./flux-build-scripts/update-flux-versions.js
|
|
- save_cache:
|
|
key: install-{{ .Environment.CACHE_VERSION }}-{{ checksum ".circleci/config.yml" }}
|
|
paths:
|
|
- /home/circleci/bin
|
|
- run:
|
|
name: Hugo Build
|
|
command: npx hugo --logLevel info --minify --destination workspace/public
|
|
- persist_to_workspace:
|
|
root: workspace
|
|
paths:
|
|
- public
|
|
|
|
deploy:
|
|
docker:
|
|
- image: cimg/go:1.22.2
|
|
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
|