CI: add job for deploying docs
This commit is contained in:
@@ -7,6 +7,7 @@ aliases:
|
|||||||
ignore:
|
ignore:
|
||||||
- master
|
- master
|
||||||
- docs
|
- docs
|
||||||
|
- 'gh-pages'
|
||||||
- &filter-only-master
|
- &filter-only-master
|
||||||
branches:
|
branches:
|
||||||
only: master
|
only: master
|
||||||
@@ -87,7 +88,7 @@ jobs:
|
|||||||
path: /tmp/circleci-test-results
|
path: /tmp/circleci-test-results
|
||||||
|
|
||||||
build-docs:
|
build-docs:
|
||||||
working_directory: ~/alexanderzobnin/grafana-zabbix
|
working_directory: ~/grafana-zabbix
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/python:2.7
|
- image: circleci/python:2.7
|
||||||
steps:
|
steps:
|
||||||
@@ -101,7 +102,27 @@ jobs:
|
|||||||
- checkout
|
- checkout
|
||||||
- run: git lfs fetch --all
|
- run: git lfs fetch --all
|
||||||
- run: cd docs && mkdocs build --clean
|
- run: cd docs && mkdocs build --clean
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: .
|
||||||
|
paths:
|
||||||
|
- docs/site
|
||||||
|
|
||||||
|
deploy-docs:
|
||||||
|
working_directory: ~/grafana-zabbix
|
||||||
|
docker:
|
||||||
|
- image: circleci/node:8
|
||||||
|
environment:
|
||||||
|
GH_PAGES_BRANCH: gh-pages
|
||||||
|
CI_GIT_USER: CircleCI
|
||||||
|
CI_GIT_EMAIL: ci@grafana.com
|
||||||
|
steps:
|
||||||
|
- add_ssh_keys:
|
||||||
|
fingerprints:
|
||||||
|
- "dc:7e:54:e0:aa:56:4d:e5:60:7b:f3:51:24:2d:d3:29"
|
||||||
|
- checkout
|
||||||
|
- attach_workspace:
|
||||||
|
at: ../gh-pages
|
||||||
|
- run: ./.circleci/deploy-docs.sh
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2
|
version: 2
|
||||||
@@ -127,3 +148,7 @@ workflows:
|
|||||||
jobs:
|
jobs:
|
||||||
- build-docs:
|
- build-docs:
|
||||||
filters: *filter-docs
|
filters: *filter-docs
|
||||||
|
- deploy-docs:
|
||||||
|
requires:
|
||||||
|
- build-docs
|
||||||
|
filters: *filter-docs
|
||||||
|
|||||||
27
.circleci/deploy-docs.sh
Executable file
27
.circleci/deploy-docs.sh
Executable file
@@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Exit script if you try to use an uninitialized variable.
|
||||||
|
set -o nounset
|
||||||
|
# Exit script if a statement returns a non-true return value.
|
||||||
|
set -o errexit
|
||||||
|
# Use the error status of the first failure, rather than that of the last item in a pipeline.
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
echo "current dir: $(pwd)"
|
||||||
|
|
||||||
|
# Setup git env
|
||||||
|
git config --global user.email $CI_GIT_EMAIL
|
||||||
|
git config --global user.name $CI_GIT_USER
|
||||||
|
echo "git user is $CI_GIT_USER ($CI_GIT_EMAIL)"
|
||||||
|
|
||||||
|
git checkout $GH_PAGES_BRANCH
|
||||||
|
rm -rf * || true
|
||||||
|
# ls -lha .
|
||||||
|
mv ../gh-pages/docs/site/* ./
|
||||||
|
# ls -lha .
|
||||||
|
# git status
|
||||||
|
git add --force .
|
||||||
|
git commit -m "build docs from commit $CIRCLE_SHA1 (branch $CIRCLE_BRANCH)"
|
||||||
|
git log -n 3
|
||||||
|
|
||||||
|
git push origin $GH_PAGES_BRANCH
|
||||||
Reference in New Issue
Block a user