Skip to content

Commit

Permalink
Automate next minor version
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Luis Vazquez Gonzalez committed Dec 15, 2021
1 parent a5f2d55 commit 1782aa9
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ build/*


dist/

next-semver/next-semver
9 changes: 9 additions & 0 deletions next-minor-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

set -euo pipefail

(cd next-semver && go build .)
./next-semver/next-semver "$(cat version)" > ./version
version=$(cat version)
git tag "v${version}" && git push origin "v${version}"

5 changes: 5 additions & 0 deletions next-semver/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module example.com/versions/next-semver

go 1.17

require github.com/Masterminds/semver/v3 v3.1.1 // indirect
2 changes: 2 additions & 0 deletions next-semver/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/Masterminds/semver/v3 v3.1.1 h1:hLg3sBzpNErnxhQtUy/mmLR2I9foDujNK030IGemrRc=
github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
19 changes: 19 additions & 0 deletions next-semver/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package main

import (
"fmt"
"os"

semverv3 "github.com/Masterminds/semver/v3"
)

func main() {
if len(os.Args) != 2 {
fmt.Printf("Usage: %s {semver-version}\n$ %s 1.2.3\n", os.Args[0], os.Args[0])
os.Exit(-1)
}
v := os.Args[1]
version := semverv3.MustParse(v)
next := version.IncPatch()
fmt.Println(next)
}
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.56
0.0.6

0 comments on commit 1782aa9

Please sign in to comment.