diff --git a/.circleci/config.yml b/.circleci/config.yml index b32b8174..cfc54a01 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,6 +36,17 @@ jobs: paths: - ~/.cache/go-build + update-docs: + docker: + - image: circleci/golang:1.12 + working_directory: /go/src/github.com/jesseduffield/lazydocker + steps: + - checkout + - run: + name: Update docs + command: | + ./.circleci/update_docs.sh + release: docker: - image: circleci/golang:1.12 @@ -66,6 +77,11 @@ workflows: build: jobs: - build + - update-docs: + filters: + branches: + only: + - master release: jobs: - release: diff --git a/.circleci/update_docs.sh b/.circleci/update_docs.sh new file mode 100755 index 00000000..54f4263b --- /dev/null +++ b/.circleci/update_docs.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +set -ex + +# see if we have a new cheatsheet +# if other docs end up being generated automatically we can chuck in the relevant scripts here +go run scripts/generate_cheatsheet.go + +# commit and push if we have a change +if [[ -z $(git status -s -- docs/*) ]]; then + echo "no changes to commit in the docs directory" + exit 0 +fi + +echo "committing updated docs" + +git config user.name "lazydocker bot" +git config user.email "jessedduffield@gmail.com" + +git add docs/* +git commit -m "update docs" +git push -u origin HEAD \ No newline at end of file