grunt-gh-pages
grunt-gh-pages copied to clipboard
feature: restrict execution to branch
You have two branches, master
and foo
. Both have the gh-pages
task defined, but foo
's is incorrect for whatever reason.
You run gh-pages
while in foo
. Whoops! The wrong files got deployed. Maybe you didn't notice.
I think most people will want to run gh-pages
against master
.
What about an option that, by default, says you cannot run the gh-pages
task from any other branch than master
? Then allow the user to provide an array of "allowed" branches if their use case differs.
Yes! This just bitten me. Deploy should only ever happen on master.
Now that I think about it (and after fixing my build) my first comment was a bit too fast. The following travis config will prevent any deploys on non-master branches:
after_success:
- test $TRAVIS_PULL_REQUEST == "false" && test $TRAVIS_BRANCH == "master" && grunt gh-pages
It might make sense to add a note to the Readme telling about this. :)
@badboy I didn't think of delegating the task to Travis. However, say I'm just running grunt gh-pages
from the command-line.
@boneskull: Yip, just wanted to mention that in my case it's possible to circumvent this through other means.