-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathpublish.sh
More file actions
executable file
·40 lines (33 loc) · 909 Bytes
/
Copy pathpublish.sh
File metadata and controls
executable file
·40 lines (33 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
# Commit a file to the status.scijava.org gh-pages branch.
# Requires SSH agent to be running with write access to status.scijava.org.
set -e
test $# -gt 1 || {
echo "Usage: publish.sh \"Commit message\" file1 [file2 ...]"
exit 2
}
datestamp="$(TZ=UTC date +'%Y-%m-%d %H:%M:%S UTC')"
message="$1 ($datestamp)"
shift
git config --global user.name github-actions
git config --global user.email github-actions@github.com
dest_dir=site-publish
git clone --depth=1 --branch=gh-pages git@github.com:scijava/status.scijava.org "$dest_dir"
while [ $# -gt 0 ]
do
file=$1
shift
test -f "$file" || { echo "File not found: $file" >&2; exit 1; }
dest=$(basename "$file")
cp "$file" "$dest_dir/$dest"
(cd "$dest_dir" && git add "$dest")
done
cd "$dest_dir"
if git diff --quiet .
then
echo "== No changes =="
else
echo "== Committing changes =="
git commit -m "$message"
git push
fi