From 60e4d3ec6e9ccc239326a750a2f4dc41df987fed Mon Sep 17 00:00:00 2001 From: Carlo Sciolla Date: Wed, 21 Aug 2019 10:52:15 +0200 Subject: [PATCH] Better version management --- README.md | 9 +++++++++ bin/set-version.sh | 33 +++++++++++++++++++++++++++++++++ plantuml-mode.el | 2 +- 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100755 bin/set-version.sh diff --git a/README.md b/README.md index 89b461b..ced20a5 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/bin/set-version.sh b/bin/set-version.sh new file mode 100755 index 0000000..c278854 --- /dev/null +++ b/bin/set-version.sh @@ -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 diff --git a/plantuml-mode.el b/plantuml-mode.el index fc75b45..322bde3 100644 --- a/plantuml-mode.el +++ b/plantuml-mode.el @@ -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)