Skip to content

Commit 6352b42

Browse files
authored
Merge pull request #67 from revbayes/deploy-checks
Deploy checks
2 parents 88bbc45 + f091d83 commit 6352b42

File tree

2 files changed

+37
-13
lines changed

2 files changed

+37
-13
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,17 @@ In order to build the site you will need `jekyll`, see instructions below to ins
2222
Making changes to the site
2323
=================
2424

25-
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.
26-
27-
./deploy.sh
25+
When making changes to the site:
26+
1. Start from the lastest version of the source branch with `git checkout source ; git pull`.
27+
2. Create a new branch for your changes with `git checkout -b <mybranchname>`.
28+
3. Commit your changes to the branch.
29+
4. Push the changes to github using `git push --set-upstream origin <mybranchname>`.
30+
5. Open a pull request (PR) for the branch on github at https://github.com/revbayes/revbayes.github.io
31+
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`.
32+
7. Now you can run the `deploy.sh` script to update the `master` branch.
33+
34+
Pull requests for the website do not currently require review, so you can merge them yourself if checks pass.
35+
These checks help to prevent the tutorials from breaking.
2836

2937
Setting up jekyll
3038
=================

deploy.sh

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,37 @@ then
6363
exit 1
6464
fi
6565

66-
msg=`git log -1 --pretty=%B`
66+
# make sure there aren't untracked files that will get uploaded to the website
67+
UNTRACKED_FILES=$(git ls-files --others --exclude-standard)
68+
if [ -n "${UNTRACKED_FILES}" ] ; then
69+
echo "Error: Untracked files. Please commit or stash before updating master."
70+
exit 1
71+
fi
6772

68-
echo "Checking out source"
69-
git checkout source
70-
echo
73+
# make sure the source branch is up-to-date with origin/source
74+
echo "Fetching content from remote"
75+
git fetch --quiet origin
7176

72-
echo "Pulling updates to the source"
73-
git pull --quiet origin source
74-
echo
77+
COUNT_MISSING="$(git rev-list --count source..origin/source)"
78+
if [ "${COUNT_MISSING}" != 0 ] ; then
79+
echo "Error: the 'source' branch is not up-to-date. Please do a 'git pull'"
80+
exit 1
81+
fi
82+
83+
COUNT_EXTRA="$(git rev-list --count origin/source..source)"
84+
if [ "${COUNT_EXTRA}" != 0 ] ; then
85+
echo "Error: the 'source' branch contains changes that have not been merged!"
86+
echo
87+
echo " Please create a PR for these changes. After the PR is merged, "
88+
echo " please pull from the source branch and run the ./deploy.sh script again."
89+
exit 1
90+
fi
7591

76-
# fetch master
77-
echo "Pulling master"
92+
# Check out master in _site
93+
echo "Checking out master in _site"
7894
(
7995
cd _site
8096
git checkout --quiet master
81-
git fetch --quiet origin
8297
git reset --quiet --hard origin/master
8398

8499
# update the documentation?
@@ -106,6 +121,7 @@ echo
106121
# deploy master
107122
(
108123
cd _site
124+
msg=`git log -1 --pretty=%B`
109125

110126
# check if there are any changes on master
111127
untracked=`git ls-files --other --exclude-standard --directory`

0 commit comments

Comments
 (0)