Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update and fix doc site deploy #137

Merged
merged 2 commits into from
Dec 21, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@
# 'npm run clean' runs rm -rf on all lines in this file.
#

_builds/
_projects/
_steps/
npm-debug.log*
node_modules/
bower_components/
testBundle.js
docs/build
docgenInfo.json
docs/app/docgenInfo.json
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaned up ignored Wercker cruft. Explicitly referenced the docInfo.json so it is cleaned up on npm run clean. This is the Stardust component info used to create the doc site.

1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

3 changes: 0 additions & 3 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
machine:
node:
version: 4.2.1
ruby:
version: 2.2.3

dependencies:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more Ruby needed on our CI since we get our changelog by github changelog api now. :D

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yesh!

pre:
- gem install github_changelog_generator
- pip install awscli

test:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No more waiting for this heavy gem install, thanks to the API.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for improved speed. Once this app is Dockerized we'll be able to cache dependencies for breezy deployments, and eliminate the external build dependency.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Expand Down
38 changes: 24 additions & 14 deletions scripts/circle_deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,19 @@ NPM_PACKAGE_VERSION=$(json -f package.json version)
git config --global user.name "tadeploy"
git config --global user.email "devteam@technologyadvice.com"

#
# build
#
gulp docs

#
# generate changelog
#
echo "...generating changelog"
github_changelog_generator $CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME
curl -X POST github-changelog-api.herokuapp.com/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME \
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was going to ask if the default machines came with curl installed (as opposed to just wget, for many vanilla *nix boxes), then I saw the build pass. ^^

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had seen it used somewhere. Had to double check this one. Found it in their docs under configuration as a valid way to install phantom.js.

Keep in mind the build passing here is only testing our components. The easiest way to test this deploy script, is to deploy it :)

| json contents > CHANGELOG.md
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We post to the changelog api, grab the contents key from the json response and write it to the changelog. Tested this locally and it works great.


#
# push to master and gh-pages
#
git add .
git add CHANGELOG.md

if [[ -n $(git status --porcelain) ]]; then
echo "...starting push, repo is dirty after build"
git commit -n -m "deploy commit by $CIRCLE_USERNAME [ci skip]"
git push origin master
git push -f origin master:gh-pages
echo "...starting push, CHANGELOG.md is dirty after build"
git commit -n -m "deploy CHANGELOG.md by $CIRCLE_USERNAME [ci skip]"
git push origin $CIRCLE_BRANCH
else
echo "...skipping push, repo is clean after build"
fi
Expand Down Expand Up @@ -64,3 +56,21 @@ else
echo "...publishing"
npm publish
fi

#
# gh-pages
#
echo "...deploying gh-pages"
git push -f $CIRCLE_BRANCH:gh-pages
git checkout gh-pages
gulp docs
git add .
git add -f docs/build

if [[ -n $(git status --porcelain) ]]; then
echo "...starting push, gh-pages is dirty after build"
git commit -n -m "deploy gh-pages by $CIRCLE_USERNAME [ci skip]"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than [ci skip] here it feels more straightforward to add a branch build specification to circle.yml and ignore the gh-pages branch: https://circleci.com/docs/configuration#branches

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 updating

git push origin gh-pages
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't -force here we may run into trouble with the deployment script during rebuilds, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The checked out gh-pages here is forced pushed from master on ln 64. So, the local copy is the latests remote copy. A rebuild should force push master to gh-pages then checkout gh-pages again. We'll see how it goes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added -f on gh-pages push for good measure, since I had to update the script for the ignored branch.

else
echo "...skipping push, gh-pages is clean after build"
fi
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pulled the gh-pages bit into it's own block here. Haven't tested this yet (first deploy will). It is pretty straight forward.

  1. Push the current branch to gh-pages (deploy is master only right now)

  2. Checkout gh-pages

  3. Build docs, add everything, force add the ignored docs/build

    This is ok because we're on the gh-pages branch here, master won't start tracking it. Removes need for an integration branch.

  4. If we have local changes, commit and push them