-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush.sh
More file actions
25 lines (22 loc) · 802 Bytes
/
push.sh
File metadata and controls
25 lines (22 loc) · 802 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
#!/bin/sh
set -eu
export LC_ALL='C'
SCRIPT_DIR="$(CDPATH='' cd -- "$(dirname -- "${0:?}")" && pwd -P)"
main() {
updatedSources="$(git status --porcelain=v1 -- "${SCRIPT_DIR:?}/data/" | awk -F'/' '{printf("* %s\n",$2)}' | sort | uniq)"
updatedReleased="$(git status --porcelain=v1 -- "${SCRIPT_DIR:?}/released/" | awk -F'/' '{printf("* %s\n",$2)}' | sort | uniq)"
commitMsg=""
if [ -n "${updatedSources}" ]; then
commitMsg="$(printf '%s\n%s' 'Updated sources:' "${updatedSources}")"
git add -- "${SCRIPT_DIR:?}/data/"
fi
if [ -n "${updatedReleased}" ]; then
commitMsg="$commitMsg\n$(printf '%s\n%s' 'Updated released:' "${updatedReleased}")"
git add -- "${SCRIPT_DIR:?}/released/"
fi
if [ -n "$commitMsg" ]; then
git commit -m "$commitMsg"
git push origin HEAD
fi
}
main "${@-}"