diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 09ab82d..13ee3c5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,6 +36,14 @@ jobs: exit 1 fi fi + + - name: ensure version is not already released + run: | + if git ls-remote --tags origin | grep -q "refs/tags/$VERSION"; then + echo "Version $VERSION already exists" + exit 1 + fi + - name: configure git with the bot credentials run: | mkdir -p ~/.ssh @@ -58,6 +66,18 @@ jobs: git rev-parse --short HEAD + - name: bump version in version file + run: | + echo $VERSION > VERSION + working-directory: ./go-mip + + - name: commit version bump + run: | + git add VERSION + git commit -m "Bumping version to $VERSION" + git push origin ${{ github.ref_name }} + working-directory: ./go-mip + - name: push release tag run: | git tag $VERSION diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..b7c0a9b --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +v1.6.0 diff --git a/version.go b/version.go new file mode 100644 index 0000000..97aecb2 --- /dev/null +++ b/version.go @@ -0,0 +1,16 @@ +// © 2019-present nextmv.io inc + +package mip + +import ( + _ "embed" + "strings" +) + +//go:embed VERSION +var version string + +// Version returns the version of the mip module. +func Version() string { + return strings.TrimSpace(version) +}