Automatic Increment Build Version's, a la "npm version major|minor|patch"

Maybe this is a how-to or maybe it’s a feature discussion, however I haven’t come across a mention of it yet, so opted for the “Feature Suggestions” category, please feel free to transfer if it’s wrongly categorized.

So, basically I would like to have a build routine or command which increments all version numbers and version codes, similar to the “npm version major|minor|patch”.

Now, I know NPM package structures are simpler as they only have a single semver token, however surely it should be possible to have some sensible defaults and then a few parameters to instruct the versioner.

Just a thought…

I would like the fuse command to support plugins.

fuse install-plugin https://github.com/pmoelgaard/fuse-cmd-semver

And then

fuse semver bump

Bjørn-Olav Strand wrote:

I would like the fuse command to support plugins.

fuse install-plugin https://github.com/pmoelgaard/fuse-cmd-semver

And then

fuse semver bump

spot on !

I doubt that we’ll prioritise doing this very soon, but in the mean time, here’s an excerpt from the script we use to do this internally:

#!/bin/sh

die () {
    echo >&2 "$@"
    exit 1
}

[ "$#" -eq 1 ] || die "usage: update-version-numbers.sh version"
VERSION=$1

echo $VERSION | grep -x '[0-9]+.[0-9]+.[0-9]+(-[0-9A-Za-z.-]+)\?' >/dev/null || die "version string error"

SEARCH_DIR="" #TODO

PATTERN="s/(\"Version\":[ ])\"[^\"]\"/\1\"$VERSION\"/"
for F in $(git ls-files $SEARCH_DIR*.unoproj);
do
    sed -e "$PATTERN" $F > $F.tmp
    mv $F.tmp $F
done

Note that this is a quickly made internal script, and could probably be improved in several ways! :slight_smile: Also, I’ve edited out some very specific things that you don’t need, but it should still work in your case. You’ll also need to fix that TODO.