Permalink
Browse files

build cli docs automatically with circleci

  • Loading branch information...
tongueroo committed Aug 12, 2018
1 parent 7a3eb87 commit ba748ab19ea46e0b2afb8337f4ce70aa3f89ffe8
Showing with 40 additions and 1 deletion.
  1. +26 −0 .circleci/bin/commit_docs.sh
  2. +13 −0 .circleci/config.yml
  3. +1 −1 lib/jets/commands/main.rb
@@ -0,0 +1,26 @@
#!/bin/bash -eux

# Even though specs also generate docs, lets run again to ensure clean slate
rake docs

out=$(git status docs)
if [[ "$out" = *"nothing to commit"* ]]; then
exit
fi

COMMIT_MESSAGE="docs updated by circleci"

# If the last commit already updated the docs, then exit.
# Preventable measure to avoid infinite loop.
if git log -1 --pretty=oneline | grep "$COMMIT_MESSAGE" ; then
exit
fi

# If reach here, we have some changes on docs that we should commit.
# Even though s
git add docs
git commit -m "$COMMIT_MESSAGE"

# https://makandracards.com/makandra/12107-git-show-current-branch-name-only
current_branch=$(git rev-parse --abbrev-ref HEAD)
git push origin "$current_branch"
@@ -84,6 +84,19 @@ jobs:
bundle exec rspec
# commit_docs.sh requires this
- run:
name: configure git
command: |
git config --global user.email "tongueroo@gmail.com"
git config --global user.name "Tung Nguyen"
- run:
name: commit cli reference docs
command: |
chmod a+x -R .circleci/bin
.circleci/bin/commit_docs.sh
- run:
name: install awscli
command: sudo apt-get update && sudo apt-get install -y awscli groff
@@ -5,7 +5,7 @@ class Main < Base

class_option :noop, type: :boolean

desc "build", "Builds and prepares project for AWS Lambda"
desc "build", "Builds and packages project for AWS Lambda"
long_desc Help.text(:build)
option :templates_only, type: :boolean, default: false, desc: "provide a way to skip building the code and only build the CloudFormation templates"
def build

0 comments on commit ba748ab

Please sign in to comment.