Skip to content

Commit

Permalink
Add convenience script to update the website repo
Browse files Browse the repository at this point in the history
  • Loading branch information
giacomofiorin committed Nov 29, 2023
1 parent 2b63fa8 commit d8b4a75
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions doc/update_website.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

COLVARS_WEBSITE_TREE=${1}
if [ -z "${COLVARS_WEBSITE_TREE}" ] ; then
echo "Error: need the full path to the website repository as argument." >&2
exit 1
fi

if grep -sq colvars ${COLVARS_WEBSITE_TREE}/index.html ; then
export COLVARS_WEBSITE_TREE
else
echo "Error: ${COLVARS_WEBSITE_TREE} does not seem to contain a Colvars webpage repository." >&2
exit 1
fi

# If needed, initialize COLVARS_RELEASE in the same way as Makefile would
if [ -z "${COLVARS_RELEASE}" ] ; then
COLVARS_RELEASE=$(git symbolic-ref --short -q HEAD)
fi
if [ -z "${COLVARS_RELEASE}" ] ; then
# If we are not working on a branch, try a tag instead
COLVARS_RELEASE=$(git describe --tags --exact-match)
fi
if [ -z "${COLVARS_RELEASE}" ] ; then
echo "Error: ${COLVARS_RELEASE} is undefined and could not be configured from a Git branch or tag." >&2
exit 1
fi

if make install && pushd ${COLVARS_WEBSITE_TREE} ; then
git add ${COLVARS_RELEASE}
if [ "x${COLVARS_RELEASE}" == "xmaster" ] ; then
git add doxygen
git add colvars-refman-*
fi
git commit -m "Update doc for version \"${COLVARS_RELEASE}\""
# Hard-code the website repository
git push [email protected]:Colvars/colvars.github.io master
popd
fi

0 comments on commit d8b4a75

Please sign in to comment.