651f211e5b80f03da22c796cf60db2714e4eacfe
3 # This script generates a commit that updates our distribution copy of OOjs UI
7 # Missing required parameter
8 echo >&2 "Usage: $0 path/to/repo/for/oojs-ui"
12 TARGET_REPO
=$
(cd "$(dirname $0)/../.."; pwd)
13 TARGET_DIR
=resources
/lib
/oojs-ui
16 function oojsuihash
() {
17 grep "OOjs UI v" "$TARGET_REPO/$TARGET_DIR/oojs-ui.js" \
19 |
grep -Eo '\([a-z0-9]+\)' \
24 function oojsuitag
() {
25 grep "OOjs UI v" "$TARGET_REPO/$TARGET_DIR/oojs-ui.js" \
27 |
grep -Eo '\bv[0-9a-z.-]+\b'
30 function oojsuiversion
() {
31 grep "OOjs UI v" "$TARGET_REPO/$TARGET_DIR/oojs-ui.js" \
33 |
grep -Eo '\bv[0-9a-z.-]+\b.*$'
36 # Prepare working tree
38 git
reset $TARGET_DIR && git checkout
$TARGET_DIR && git fetch origin
&&
39 git checkout
-B upstream-oojsui origin
/master ||
exit 1
43 # Read the old version and check for changes
49 if [ "$OLDHASH" == "" ]
51 OLDHASH
=$
(git rev-parse
"$OLDTAG")
54 echo "Could not find OOjs UI version"
59 if [ "$(git rev-parse $OLDHASH)" == "$(git rev-parse HEAD)" ]
61 echo "No changes (already at $OLDHASH)"
66 # Build the distribution
67 npm
install && grunt git-build ||
exit 1
69 # Get the list of changes
70 NEWCHANGES
=$
(git log
$OLDHASH..
--oneline --no-merges --reverse --color=never
)
71 NEWCHANGESDISPLAY
=$
(git log
$OLDHASH..
--oneline --no-merges --reverse --color=always
)
74 # - Exclude the minimised distribution files and RTL sheets for non-CSSJanus environments
75 rsync
--recursive --delete --force --exclude 'oojs-ui*.min.*' --exclude 'oojs-ui*.rtl.css' .
/dist
/ "$TARGET_REPO/$TARGET_DIR" ||
exit 1
77 # Read the new version
78 NEWVERSION
=$
(oojsuiversion
)
83 Update OOjs UI to $NEWVERSION
89 git add
-u $TARGET_DIR && git add
$TARGET_DIR && git commit
-m "$COMMITMSG"
93 Created commit with changes: