34 lines
795 B
Bash
34 lines
795 B
Bash
|
#!/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}"
|
||
|
sed -i -E "s/plantuml-mode-version \"[1-9\.]+\"/plantuml-mode-version \"${1}\"/" plantuml-mode.el
|
||
|
}
|
||
|
|
||
|
case "$(git rev-parse --abbrev-ref HEAD)" in
|
||
|
'master')
|
||
|
VERSION="$(grab_version)"
|
||
|
update_version "${VERSION}"
|
||
|
git add plantuml-mode.el
|
||
|
;;
|
||
|
|
||
|
'develop')
|
||
|
VERSION="$(date '+%Y%m%d.%H%M')" # MELPA style
|
||
|
update_version "${VERSION}"
|
||
|
git add plantuml-mode.el
|
||
|
;;
|
||
|
|
||
|
*)
|
||
|
## do nothing
|
||
|
;;
|
||
|
esac
|