File tree Expand file tree Collapse file tree 2 files changed +15
-11
lines changed Expand file tree Collapse file tree 2 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -68,10 +68,11 @@ The backup script will source this file if present.
6868## Weekly plot update script
6969
7070` scripts/update_plots.sh ` generates plots with ` src/run.py plot ` and pushes them
71- to a clone of the ` nipreps.github.io ` website. The path to that clone can be
72- given as an argument and defaults to ` $HOME/workspace/nipreps.github.io ` .
73- The script may be run from any directory and validates that the target is a Git
74- repository.
71+ to the ` nipreps.github.io ` website. The script clones the repository to a
72+ temporary directory (by default using
` [email protected] :nipreps/nipreps.github.io.git` ),
73+ writes the plots there, commits and pushes the changes, and removes the
74+ temporary clone. You may pass an alternative repository URL as an argument.
75+ The script may be run from any directory.
7576
7677Make the script executable:
7778
Original file line number Diff line number Diff line change 44
55set -euo pipefail
66
7- REPO_DIR =" ${1:- $HOME / workspace / nipreps.github.io} "
8- ASSETS_DIR =" $REPO_DIR /docs/assets "
7+ REPO_URL =" ${1:- git @ github.com : nipreps / nipreps.github.io.git } "
8+ TMP_REPO =" $( mktemp -d ) "
99
10- if [ ! -d " $REPO_DIR /.git" ]; then
11- echo " Error: $REPO_DIR is not a git repository" >&2
12- exit 1
13- fi
10+ cleanup () {
11+ rm -rf " $TMP_REPO "
12+ }
13+ trap cleanup EXIT
14+
15+ git clone " $REPO_URL " " $TMP_REPO "
1416
17+ ASSETS_DIR=" $TMP_REPO /docs/assets"
1518mkdir -p " $ASSETS_DIR "
1619
1720SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
1821cd " $SCRIPT_DIR /.."
1922
2023python src/run.py plot -o " $ASSETS_DIR "
2124
22- cd " $REPO_DIR "
25+ cd " $TMP_REPO "
2326git pull --ff-only
2427git add docs/assets
2528if ! git diff --cached --quiet; then
You can’t perform that action at this time.
0 commit comments