2019-08-21 08:52:15 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Retrieves the version from the changelog in plantuml-mode.el
|
|
|
|
function grab_version(){
|
|
|
|
grep ';; version' plantuml-mode.el | \
|
|
|
|
head -n1 | \
|
|
|
|
cut -f3 -d' ' | \
|
|
|
|
tr -d ','
|
|
|
|
}
|
|
|
|
|
|
|
|
# Updates the version in-place
|
|
|
|
function update_version(){
|
|
|
|
NEW_VERSION="${1}"
|
2019-08-21 10:06:38 +00:00
|
|
|
sed -i -E "s/plantuml-mode-version \"[0-9\.]+\"/plantuml-mode-version \"${1}\"/" plantuml-mode.el
|
2019-08-21 08:52:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
case "$(git rev-parse --abbrev-ref HEAD)" in
|
|
|
|
'master')
|
|
|
|
VERSION="$(grab_version)"
|
|
|
|
update_version "${VERSION}"
|
|
|
|
git add plantuml-mode.el
|
|
|
|
;;
|
|
|
|
|
|
|
|
'develop')
|
2019-08-21 10:06:38 +00:00
|
|
|
VERSION="$(TZ='UTC' date '+%Y%m%d.%-H%M')" # MELPA style
|
2019-08-21 08:52:15 +00:00
|
|
|
update_version "${VERSION}"
|
|
|
|
git add plantuml-mode.el
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
## do nothing
|
|
|
|
;;
|
|
|
|
esac
|