Better version management

This commit is contained in:
Carlo Sciolla 2019-08-21 10:52:15 +02:00
parent 7eb6167eb8
commit 60e4d3ec6e
No known key found for this signature in database
GPG Key ID: BA5D71E6F3C580C1
3 changed files with 43 additions and 1 deletions

View File

@ -139,11 +139,20 @@ the textual mode and see if the output is valid SVG.
## Development
Development happens mostly on the `develop` branch, which is released on MELPA at every commit. The `master` branch is used to generate tags which are then released to [MELPA
stable](https://stable.melpa.org).
In order to contribute to `plantuml-mode` make sure to:
- agree with the [GPLv3+ licencing terms](#License) as they are mandated by Emacs
- install [`cask`](https://github.com/cask/cask)
- always test your code and run the full test suite with `cask exec ert-runner` (or just by `make`)
- ensure you always target `develop` in your pull requests
For collaborators who have merge access to the repo:
- make sure [`set-version.sh`](./blob/develop/bin/set-version.sh) is run as part of your [`pre-commit` git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks)
- always merge PRs on the command line
- when releasing a new stable version, add the proper entry in the changelog within `plantuml-mode.el` to ensure the right version is set for `plantuml-mode-version`
# Credits

33
bin/set-version.sh Executable file
View File

@ -0,0 +1,33 @@
#!/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

View File

@ -92,7 +92,7 @@
(defvar plantuml-mode-hook nil "Standard hook for plantuml-mode.")
(defconst plantuml-mode-version "1.3.1" "The plantuml-mode version string.")
(defconst plantuml-mode-version "20190821.1053" "The plantuml-mode version string.")
(defvar plantuml-mode-debug-enabled nil)