#!/bin/bash -eu
if [ -z "${1:-}" ]
then
# Missing parameters
echo >&2 "usage: $(basename $0) <version>"
echo ''
echo ' <version> MediaWiki version, e.g. "1.25"'
exit 1
fi
remote='origin'
version=$1
git remote update $remote
git remote prune $remote
refs=`git for-each-ref --format='%(refname)' refs/remotes/${remote}/wmf/${version}wmf*`
for ref in $refs; do
branch=$(echo $ref | cut -d '/' -f 4-6)
git tag $branch $ref > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo "... created tag $branch"
else
echo "Could not (re)create tag $branch"
fi
git push $remote :$branch > /dev/null 2>&1
if [[ $? == 0 ]]; then
echo "... removed branch $branch"
else
echo "Could not remove $branch"
fi
done
echo "... publishing tags"
git push $remote --tags
git remote update $remote
git remote prune $remote