-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Pull gh-pages building to deploy script (pull #445)
Move the logic for doing the manual gh-pages deployment to the built-in Travis-CI “script” deployment. This allows all branches to be built and tested, but only the master branch to be deployed.
- Loading branch information
Showing
3 changed files
with
44 additions
and
33 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 |
---|---|---|
|
@@ -3,40 +3,14 @@ language: node_js | |
node_js: | ||
- "node" | ||
|
||
env: | ||
global: | ||
- GH_REF: github.com/w3c/aria-practices.git | ||
|
||
addons: | ||
apt: | ||
packages: | ||
- oracle-java8-installer | ||
- oracle-java8-set-default | ||
|
||
git: | ||
depth: 3 | ||
|
||
branches: | ||
only: | ||
master | ||
|
||
install: | ||
- npm install && npm test | ||
|
||
before_script: | ||
- git config --global user.email "[email protected]" | ||
- git config --global user.name "michael-n-cooper" | ||
|
||
script: | ||
- cd ../.. | ||
- mkdir gh-pages | ||
- cd gh-pages | ||
- git clone --depth=1 --branch=gh-pages https://github.com/w3c/aria-practices.git | ||
- cd aria-practices | ||
- curl "https://labs.w3.org/spec-generator/?type=respec&url=https://rawgit.com/w3c/aria-practices/master/aria-practices.html" -o index.html -f --retry 3 | ||
- cp -r ../../w3c/aria-practices/examples . | ||
before_deploy: scripts/travis-before_deploy.sh | ||
|
||
after_success: | ||
- git add . | ||
- git commit -m "Generated by TRAVIS-CI" | ||
- git push "https://${GH_TOKEN}@${GH_REF}" gh-pages > /dev/null 2>&1 | ||
deploy: | ||
provider: script | ||
skip_cleanup: true | ||
script: /tmp/deploy/travis-deploy.sh | ||
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,24 @@ | ||
#!/bin/bash | ||
|
||
# Stash the latest examples | ||
mkdir /tmp/aria-practices | ||
cp -R common /tmp/aria-practices | ||
cp -R examples /tmp/aria-practices | ||
cp -R img /tmp/aria-practices | ||
cp .gitignore /tmp/aria-practices | ||
cp .editorconfig /tmp/aria-practices | ||
cp README.md /tmp/aria-practices | ||
|
||
mkdir /tmp/deploy | ||
cp scripts/travis-deploy.sh /tmp/deploy/ | ||
|
||
# Grab the gh-pages branch | ||
git fetch --depth=1 origin gh-pages:gh-pages | ||
git checkout gh-pages | ||
curl "https://labs.w3.org/spec-generator/?type=respec&url=https://rawgit.com/${TRAVIS_REPO_SLUG}/master/aria-practices.html" -o index.html -f --retry 3 | ||
|
||
# Clean and update the examples | ||
rm -rf common/ | ||
rm -rf examples/ | ||
rm -rf img/ | ||
cp -R /tmp/aria-practices/ .. |
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,13 @@ | ||
#!/bin/bash | ||
|
||
if [ -z "$GH_TOKEN" ]; then | ||
echo "To deploy to your gh-pages branch, the GH_TOKEN needs to be defined by following https://docs.travis-ci.com/user/environment-variables/#Defining-Variables-in-Repository-Settings" | ||
exit 1 | ||
fi | ||
|
||
echo 'Pushing built changes' | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "michael-n-cooper" | ||
git config remote.origin.url "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" | ||
git commit -am "Generated by TRAVIS-CI ${TRAVIS_COMMIT}" -m "${TRAVIS_COMMIT_MESSAGE}" | ||
git push --set-upstream origin gh-pages > /dev/null 2>&1 |