Add scripts to generate update builds of OOjs and OOjs UI
Change-Id: Ib2e156cbd56dda3d32953d75bafca608eda974ad
This commit is contained in:
parent
425c9cbdfd
commit
c68b967e3a
2 changed files with 186 additions and 0 deletions
93
resources/oojs-ui/update-oojs-ui.sh
Executable file
93
resources/oojs-ui/update-oojs-ui.sh
Executable file
|
|
@ -0,0 +1,93 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# FIXME this script is duplicated from update-oojs.sh - factor this out
|
||||||
|
|
||||||
|
# This script generates a commit that updates the oojs-ui distribution
|
||||||
|
# ./bin/update-oojs-ui.sh path/to/repo/for/oojs-ui
|
||||||
|
|
||||||
|
function oojsuihash() {
|
||||||
|
grep "OOjs UI v" resources/oojs-ui/oojs-ui.js \
|
||||||
|
| head -n 1 \
|
||||||
|
| grep -Eo '\([a-z0-9]+\)' \
|
||||||
|
| sed 's/^(//' \
|
||||||
|
| sed 's/)$//'
|
||||||
|
}
|
||||||
|
|
||||||
|
function oojsuitag() {
|
||||||
|
grep "OOjs UI v" resources/oojs-ui/oojs-ui.js \
|
||||||
|
| head -n 1 \
|
||||||
|
| grep -Eo '\bv[0-9a-z.-]+\b'
|
||||||
|
}
|
||||||
|
|
||||||
|
function oojsuiversion() {
|
||||||
|
grep "OOjs UI v" resources/oojs-ui/oojs-ui.js \
|
||||||
|
| head -n 1 \
|
||||||
|
| grep -Eo '\bv[0-9a-z.-]+\b.*$'
|
||||||
|
}
|
||||||
|
|
||||||
|
# cd to the VisualEditor directory
|
||||||
|
cd $(cd $(dirname $0)/../..; pwd)
|
||||||
|
|
||||||
|
if [ "x$1" == "x" ]
|
||||||
|
then
|
||||||
|
echo >&2 "Usage: update-oojs-ui.sh path/to/repo/for/oojs-ui"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Undo any changes in the oojs-ui directory
|
||||||
|
git reset resources/oojs-ui/
|
||||||
|
git checkout resources/oojs-ui/
|
||||||
|
# Get the old oojs-ui version
|
||||||
|
OLDVERSION=$(oojsuihash)
|
||||||
|
if [ "x$OLDVERSION" == "x" ]
|
||||||
|
then
|
||||||
|
TAG=$(oojsuitag)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# cd to the oojs-ui directory
|
||||||
|
cd $1 || exit 1
|
||||||
|
if [ "x$OLDVERSION" == "x" ]
|
||||||
|
then
|
||||||
|
# Try the tag
|
||||||
|
OLDVERSION=$(git rev-parse $TAG)
|
||||||
|
if [ $? != 0 ]
|
||||||
|
then
|
||||||
|
echo Could not find OOjs UI version
|
||||||
|
cd -
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "$(git rev-parse $OLDVERSION)" == "$(git rev-parse HEAD)" ]
|
||||||
|
then
|
||||||
|
echo "No changes (already at $OLDVERSION)"
|
||||||
|
cd -
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
# Build the distribution
|
||||||
|
grunt
|
||||||
|
# Get the list of changes
|
||||||
|
NEWCHANGES=$(git log $OLDVERSION.. --oneline --no-merges --reverse --color=never)
|
||||||
|
NEWCHANGESDISPLAY=$(git log $OLDVERSION.. --oneline --no-merges --reverse --color=always)
|
||||||
|
# cd back to the VisualEditor directory
|
||||||
|
cd -
|
||||||
|
|
||||||
|
# Copy files from dist/ to resources/oojs-ui
|
||||||
|
cp -a $1/dist/{oojs-ui.js,oojs-ui.svg.css,images,i18n} resources/oojs-ui/
|
||||||
|
# Figure out what the new version is
|
||||||
|
NEWVERSION=$(oojsuiversion)
|
||||||
|
# Generate commit summary
|
||||||
|
COMMITMSG=$(cat <<END
|
||||||
|
Update OOjs UI to $NEWVERSION
|
||||||
|
|
||||||
|
New changes:
|
||||||
|
$NEWCHANGES
|
||||||
|
END
|
||||||
|
)
|
||||||
|
# Commit
|
||||||
|
git commit resources/oojs-ui/ -m "$COMMITMSG"
|
||||||
|
cat >&2 <<END
|
||||||
|
|
||||||
|
|
||||||
|
Created commit with changes:
|
||||||
|
$NEWCHANGESDISPLAY
|
||||||
|
END
|
||||||
93
resources/oojs/update-oojs.sh
Executable file
93
resources/oojs/update-oojs.sh
Executable file
|
|
@ -0,0 +1,93 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# FIXME this script is duplicated from update-oojs-ui.sh - factor this out
|
||||||
|
|
||||||
|
# This script generates a commit that updates the oojs distribution
|
||||||
|
# ./bin/update-oojs.sh path/to/repo/for/oojs
|
||||||
|
|
||||||
|
function oojshash() {
|
||||||
|
grep "OOjs v" resources/oojs/oojs.js \
|
||||||
|
| head -n 1 \
|
||||||
|
| grep -Eo '\([a-z0-9]+\)' \
|
||||||
|
| sed 's/^(//' \
|
||||||
|
| sed 's/)$//'
|
||||||
|
}
|
||||||
|
|
||||||
|
function oojstag() {
|
||||||
|
grep "OOjs v" resources/oojs/oojs.js \
|
||||||
|
| head -n 1 \
|
||||||
|
| grep -Eo '\bv[0-9a-z.-]+\b'
|
||||||
|
}
|
||||||
|
|
||||||
|
function oojsversion() {
|
||||||
|
grep "OOjs v" resources/oojs/oojs.js \
|
||||||
|
| head -n 1 \
|
||||||
|
| grep -Eo '\bv[0-9a-z.-]+\b.*$'
|
||||||
|
}
|
||||||
|
|
||||||
|
# cd to the MW directory
|
||||||
|
cd $(cd $(dirname $0)/../..; pwd)
|
||||||
|
|
||||||
|
if [ "x$1" == "x" ]
|
||||||
|
then
|
||||||
|
echo >&2 "Usage: update-oojs.sh path/to/repo/for/oojs"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Undo any changes in the oojs directory
|
||||||
|
git reset resources/oojs/
|
||||||
|
git checkout resources/oojs/
|
||||||
|
# Get the old oojs version
|
||||||
|
OLDVERSION=$(oojshash)
|
||||||
|
if [ "x$OLDVERSION" == "x" ]
|
||||||
|
then
|
||||||
|
TAG=$(oojstag)
|
||||||
|
fi
|
||||||
|
|
||||||
|
# cd to the oojs directory
|
||||||
|
cd $1 || exit 1
|
||||||
|
if [ "x$OLDVERSION" == "x" ]
|
||||||
|
then
|
||||||
|
# Try the tag
|
||||||
|
OLDVERSION=$(git rev-parse $TAG)
|
||||||
|
if [ $? != 0 ]
|
||||||
|
then
|
||||||
|
echo Could not find OOjs version
|
||||||
|
cd -
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "$(git rev-parse $OLDVERSION)" == "$(git rev-parse HEAD)" ]
|
||||||
|
then
|
||||||
|
echo "No changes (already at $OLDVERSION)"
|
||||||
|
cd -
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
# Build the distribution
|
||||||
|
grunt
|
||||||
|
# Get the list of changes
|
||||||
|
NEWCHANGES=$(git log $OLDVERSION.. --oneline --no-merges --reverse --color=never)
|
||||||
|
NEWCHANGESDISPLAY=$(git log $OLDVERSION.. --oneline --no-merges --reverse --color=always)
|
||||||
|
# cd back to the VisualEditor directory
|
||||||
|
cd -
|
||||||
|
|
||||||
|
# Copy files from dist/ to resources/oojs/
|
||||||
|
cp -a $1/dist/* resources/oojs/
|
||||||
|
# Figure out what the new version is
|
||||||
|
NEWVERSION=$(oojsversion)
|
||||||
|
# Generate commit summary
|
||||||
|
COMMITMSG=$(cat <<END
|
||||||
|
Update OOjs to $NEWVERSION
|
||||||
|
|
||||||
|
New changes:
|
||||||
|
$NEWCHANGES
|
||||||
|
END
|
||||||
|
)
|
||||||
|
# Commit
|
||||||
|
git commit resources/oojs/ -m "$COMMITMSG"
|
||||||
|
cat >&2 <<END
|
||||||
|
|
||||||
|
|
||||||
|
Created commit with changes:
|
||||||
|
$NEWCHANGESDISPLAY
|
||||||
|
END
|
||||||
Loading…
Reference in a new issue