diff --git a/README.md b/README.md index d23e9f61..1d275743 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,17 @@ In order to build the site you will need `jekyll`, see instructions below to ins Making changes to the site ================= -When making changes to the site, you should always work on the `source` branch. After committing your changes to `source`, simply run the `deploy.sh` script. This script will take care of the steps involved to push both the `source` and `master` branches to github. - - ./deploy.sh +When making changes to the site: +1. Start from the lastest version of the source branch with `git checkout source ; git pull`. +2. Create a new branch for your changes with `git checkout -b `. +3. Commit your changes to the branch. +4. Push the changes to github using `git push --set-upstream origin `. +5. Open a pull request (PR) for the branch on github at https://github.com/revbayes/revbayes.github.io +6. After the pull request is merged to the `source` branch on github, move back to the source branch locally with `git checkout source` and fetch the latest version with `git pull`. +7. Now you can run the `deploy.sh` script to update the `master` branch. + +Pull requests for the website do not currently require review, so you can merge them yourself if checks pass. +These checks help to prevent the tutorials from breaking. Setting up jekyll ================= diff --git a/deploy.sh b/deploy.sh index 4027f741..f147e10c 100755 --- a/deploy.sh +++ b/deploy.sh @@ -63,22 +63,37 @@ then exit 1 fi -msg=`git log -1 --pretty=%B` +# make sure there aren't untracked files that will get uploaded to the website +UNTRACKED_FILES=$(git ls-files --others --exclude-standard) +if [ -n "${UNTRACKED_FILES}" ] ; then + echo "Error: Untracked files. Please commit or stash before updating master." + exit 1 +fi -echo "Checking out source" -git checkout source -echo +# make sure the source branch is up-to-date with origin/source +echo "Fetching content from remote" +git fetch --quiet origin -echo "Pulling updates to the source" -git pull --quiet origin source -echo +COUNT_MISSING="$(git rev-list --count source..origin/source)" +if [ "${COUNT_MISSING}" != 0 ] ; then + echo "Error: the 'source' branch is not up-to-date. Please do a 'git pull'" + exit 1 +fi + +COUNT_EXTRA="$(git rev-list --count origin/source..source)" +if [ "${COUNT_EXTRA}" != 0 ] ; then + echo "Error: the 'source' branch contains changes that have not been merged!" + echo + echo " Please create a PR for these changes. After the PR is merged, " + echo " please pull from the source branch and run the ./deploy.sh script again." + exit 1 +fi -# fetch master -echo "Pulling master" +# Check out master in _site +echo "Checking out master in _site" ( cd _site git checkout --quiet master - git fetch --quiet origin git reset --quiet --hard origin/master # update the documentation? @@ -106,6 +121,7 @@ echo # deploy master ( cd _site + msg=`git log -1 --pretty=%B` # check if there are any changes on master untracked=`git ls-files --other --exclude-standard --directory`