Skip to content

Commit

Permalink
build cli docs automatically with circleci
Browse files Browse the repository at this point in the history
  • Loading branch information
tongueroo committed Aug 12, 2018
1 parent 7a3eb87 commit ba748ab
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .circleci/bin/commit_docs.sh
Original file line number Diff line number Diff line change
@@ -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"
13 changes: 13 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/jets/commands/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ba748ab

Please sign in to comment.