The docpad-plugin-ghpages
uses the following information to stitch a new repo with contents of ./out
directory onto root of your gh-pages
branch:
git config user.email
git config user.name
git config remote.origin.url
- uses this url for the git push to your gh-pages branchIt turns out that your github token
is a valid username, such that $token@github.com:$user/$repo.git
is a valid, authorized git url. Any process that can grab valid values for these three pieces of information will be able to produce new changes in github.com.
Using prebuild.sh
to retrieve all three pieces of information from the output travis encrypt
allows you to echo the user name and email for debugging, and primes travis for a successful run of docpad deploy-ghpages
.
language: node_js
before_script:
- ./prebuild.sh
script:
- docpad deploy-ghpages
env:
global:
- FOO="BAR"
- GH_REPO="medevice-users/gallery"
# append a travis secret to .travis.yml
# include some known debuggable strings along with your secret
# commit the result
travis encrypt --add -r user-org-name/repo-name 'GIT_NAME="Your Committer Name [via travis key]" GIT_EMAIL=committer@example.com GH_TOKEN=ahead0fxxxxxxxxxxxxxxxxxxx'
#####
# EOF
If you have a .travis.yml
already, this will add a secret
variable. Make sure to delete any previous secret, so that the only one available is this one. My brief testing suggests all pieces of information are required, and you’ll be glad you can echo some non-sensitive bits from the same serialization for debugging later.
TL;DR
TL;DR
- send a few variables you feel comfortable echoing for debug
- make sure you that git config remote.origin.url has output.
- make sure git is configured with your username and email
Having difficulty getting this working on travis. For some reason, git is not getting the new specially authorized remote url.
Fails with:
Using worker: worker-linux-2-2.bb.travis-ci.org:travis-linux-6
$ export FOO="BAR"
$ export GH_REPO="medevice-users/gallery"
$ export GIT_NAME=[secure]
$ export GIT_EMAIL=[secure]
$ export GH_TOKEN=[secure]
travis_fold:start:git.1
$ git clone --depth=50 --branch=master git://github.com/medevice-users/gallery.git medevice-users/gallery
Cloning into 'medevice-users/gallery'...
remote: Counting objects: 798, done.[K
[...]
travis_fold:end:install
travis_fold:start:before_script.1
$ export REPO_URL="https://$GH_TOKEN@github.com/$GH_REPO.git"
travis_fold:end:before_script.1
travis_fold:start:before_script.2
$ ./prebuild.sh
HELLO WORLD set up medevice-users/gallery [via travis] for Ben West [via travis] <bewest@gmail.com>
STATUS
# HEAD detached at d797dbf
nothing to commit, working directory clean
remotes pre pre-authorized remote url
old git://github.com/medevice-users/gallery.git (fetch)
old git://github.com/medevice-users/gallery.git (push)
travis_fold:end:before_script.2
$ docpad deploy-ghpages
[32minfo:[39m Welcome to DocPad v6.46.4
[32minfo:[39m Contribute: http://docpad.org/docs/contribute
[32minfo:[39m Plugins: cleanurls, coffeescript, eco, ghpages, jade, less, livereload, marked, paged, partials, related, stylus, text
[32minfo:[39m Environment: static
[32minfo:[39m Deployment to GitHub Pages starting...
[32minfo:[39m Generating...
[32minfo:[39m Generated 45/45 files in 6.74 seconds
Initialized empty Git repository in /home/travis/build/medevice-users/gallery/out/.git/
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: empty ident name (for <travis@testing-worker-linux-2-2-16953-linux-6.(none)>) not allowed
[31merror:[39m Something went wrong with the action
[31merror:[39m An error occured:
Error:
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: empty ident name (for <travis@testing-worker-linux-2-2-16953-linux-6.(none)>) not allowed
at ChildProcess.<anonymous> (/home/travis/build/medevice-users/gallery/node_modules/docpad-plugin-ghpages/node_modules/safeps/out/lib/safeps.js:154:21)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Socket.<anonymous> (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
The command "docpad deploy-ghpages" exited with 1.
Done. Your build exited with 1.
Runs equivalent of?:
ghpages.plugin.coffee
rootPath="./" # ?
rm -Rm out/.git
( cd $rootPath/out;
url=$(git config remote.origin.url)
lastCommit=$(git log --oneline | head -n 1)
git init
git add .
git commit -m $lastCommit
git push --force $url master:gh-pages
)
If you are wanting to open-source your website, we suggest using the Creative Commons Attribution License for content and the MIT License for code.