-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable Travis to auto-build HTML output
- Loading branch information
Showing
5 changed files
with
73 additions
and
2,848 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
index.html | ||
deploy_key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
language: python | ||
python: | ||
- '2.7' | ||
env: | ||
global: | ||
- COMMIT_AUTHOR_EMAIL=travis-ci@w3.org | ||
install: | ||
- git clone --depth=1 --branch=master https://github.com/tabatkins/bikeshed.git ./bikeshed | ||
- pip install pygments | ||
- pip install --upgrade setuptools | ||
- pip install --editable ./bikeshed | ||
- bikeshed update | ||
script: | ||
- mkdir out | ||
- bikeshed spec index.bs out/index.html | ||
before_deploy: | ||
- openssl aes-256-cbc -K $encrypted_b330ad4127a4_key -iv $encrypted_b330ad4127a4_iv | ||
-in deploy_key.enc -out deploy_key -d | ||
deploy: | ||
provider: script | ||
skip_cleanup: true | ||
script: "./deploy.sh" | ||
This comment has been minimized.
Sorry, something went wrong. |
||
on: | ||
branch: master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
set -e # Exit with nonzero exit code if anything fails | ||
|
||
# Expects that the build script will place the contents of gh-pages into out/. | ||
# Expects that the before_deploy steps will place a deploy key in ./deploy_key. | ||
|
||
TARGET_BRANCH=gh-pages | ||
|
||
# Save some useful information | ||
REPO=`git config remote.origin.url` | ||
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:} | ||
SHA=`git rev-parse --verify HEAD` | ||
|
||
CLONED_TARGET_BRANCH=$(mktemp -d) | ||
# Clone the existing gh-pages for this repo into out/ | ||
git clone --depth 1 --branch $TARGET_BRANCH $REPO $CLONED_TARGET_BRANCH | ||
|
||
# Copy over the out/ directory, removing any old contents. | ||
rsync -r --exclude .git --delete out/ $CLONED_TARGET_BRANCH | ||
|
||
# Install the deploy key. | ||
chmod 600 deploy_key | ||
eval `ssh-agent -s` | ||
if ! ssh-add deploy_key; then | ||
echo "Unable to add SSH identity; exiting." | ||
exit 1 | ||
fi | ||
|
||
# Now let's go have some fun with the cloned repo | ||
cd $CLONED_TARGET_BRANCH | ||
# If there are no changes to the compiled out (e.g. this is a README update) then just bail. | ||
if git diff --quiet; then | ||
echo "No changes to the output on this push; exiting." | ||
exit 0 | ||
fi | ||
|
||
git config user.name "Travis CI" | ||
git config user.email "$COMMIT_AUTHOR_EMAIL" | ||
|
||
# Commit the "changes", i.e. the new version. | ||
# The delta will show diffs between new and old versions. | ||
git add -A . | ||
git commit -m "Deploy to GitHub Pages: ${SHA}" | ||
|
||
# Now that we're all set up, we can push. | ||
git push $SSH_REPO $TARGET_BRANCH | ||
|
Binary file not shown.
Oops, something went wrong.
FYI, I learned a few weeks ago about "provider: pages", which I used to simplify some of my similar setups to not have a deploy key. https://github.com/w3c/speech-api/blob/master/.travis.yml is an example.