Skip to content

Commit fa83d8d

Browse files
authored
Merge pull request #14 from maykonlf/develop
2 parents 370daa0 + 848dc08 commit fa83d8d

File tree

6 files changed

+794
-108
lines changed

6 files changed

+794
-108
lines changed

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
golang 1.13
1+
golang 1.17.8

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.13-alpine3.10 as builder
1+
FROM golang:1.17-alpine as builder
22
RUN mkdir /build
33
ADD . /build/
44
WORKDIR /build

Makefile

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,28 @@ test: fmtcheck
2727
@sh -c "go test ./... -timeout=2m -parallel=4"
2828

2929
build:
30-
CGO_ENABLED=0
31-
GOOS=linux
32-
@go build -o semver ./cmd/semver
30+
@go build -o ./semver ./cmd/semver
3331

34-
.PHONY: default test cover fmt fmtcheck lint
32+
build-linux-amd64:
33+
@mkdir -p ./dist/linux-amd64
34+
@CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./dist/linux-amd64/semver ./cmd/semver
35+
@echo "./dist/linux-amd64/semver (linux/amd64)"
36+
37+
build-windows-amd64:
38+
@mkdir -p ./dist/windows-amd64
39+
@CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ./dist/windows-amd64/semver.exe ./cmd/semver
40+
@echo "./dist/windows-amd64/semver.exe (windows/amd64)"
41+
42+
build-macos-arm64:
43+
@mkdir -p ./dist/macos-arm64
44+
@CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o ./dist/macos-arm64/semver ./cmd/semver
45+
@echo "./dist/darwin-arm64/semver (darwin/arm64 - MacOS M1)"
46+
47+
build-macos-amd64:
48+
@mkdir -p ./dist/macos-amd64
49+
@CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o ./dist/macos-amd64/semver ./cmd/semver
50+
@echo "./dist/darwin-amd64/semver (darwin/amd64 - MacOS Intel)"
51+
52+
build-all: build build-linux-amd64 build-windows-amd64 build-macos-arm64 build-macos-amd64
53+
54+
.PHONY: default test cover fmt fmtcheck lint build

README.md

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
11
# Semantic Versioning Tool
22

3-
An easy to use CLI tool to manage your projects current version and its upgrades according to the Semantic Versioning specification.
4-
3+
An easy to use CLI tool to manage your projects current version and its upgrades according to the Semantic Versioning
4+
specification.
55

66
## Getting Started
77

88
### Install
9+
910
If you already have golang installed you can install by running the command:
11+
1012
```sh
11-
go get -u github.com/maykonlf/semver-cli/cmd/semver
13+
go install github.com/maykonlf/semver-cli/cmd/semver@latest
1214
```
1315

1416
### check install
17+
1518
Check if the semver was instaled running the command:
19+
1620
```sh
1721
semver
1822
```
1923

20-
2124
### Init semver
25+
2226
To start managing your project versions enter into the project folder, then run:
27+
2328
```sh
2429
semver init
2530
```
2631

27-
This command will start the versioning based on release version v1.0.0. If you want to start with another version number you car run instead:
32+
This command will start the versioning based on release version v1.0.0. If you want to start with another version number
33+
you car run instead:
34+
2835
```sh
2936
semver init \
3037
--release [base release version] \
@@ -34,62 +41,79 @@ semver init \
3441
[--force] # to override an already initialized semver in the current directory.
3542
```
3643

37-
3844
## Usage
3945

4046
### Get current version
47+
4148
#### Alpha
49+
4250
Returns the current alpha version (if none will return and "-alpha.0" version).
51+
4352
```sh
4453
$ semver get alpha
4554
v1.0.0-alpha.6
4655
```
4756

4857
#### Beta
58+
4959
Returns the current beta version (if none will return and "-beta.0" version).
60+
5061
```sh
5162
$ semver get beta
5263
v1.0.0-beta.3
5364
```
5465

5566
#### Release Candidate
67+
5668
Returns the current release candidate version (if none will return and "-rc.0" version).
69+
5770
```sh
5871
$ semver get rc
5972
v1.0.0-rc.1
6073
```
6174

6275
#### Release
76+
6377
Returns the current release version.
78+
6479
```sh
6580
$ semver get release
6681
v1.0.0
6782
```
6883

6984
### Upgrade version
85+
7086
#### Alpha
87+
7188
Increment the current alpha version by 1. If none starts with 1.
89+
7290
```sh
7391
$ semver up alpha
7492
v1.0.0-alpha.7
7593
```
7694

7795
#### Beta
96+
7897
Increment the current beta version by 1. If none starts with 1.
98+
7999
```sh
80100
$ semver up beta
81101
v1.0.0-beta.4
82102
```
83103

84104
#### Release Candidate
105+
85106
Increment the current release candidate version by 1. If none starts with 1.
107+
86108
```sh
87109
$ semver up rc
88110
v1.0.0-rc.2
89111
```
90112

91113
#### Release
114+
92115
Upgrade an alpha, beta or rc to its final release version. Also increments the patch number by 1 to a release version:
116+
93117
```sh
94118
$ semver up release
95119
v1.0.0
@@ -99,13 +123,17 @@ v1.0.1
99123
```
100124

101125
#### Minor
102-
Increments release minor version number by 1 (useful when you start working on next release version) and clear alpha, beta, rc and patch number.
126+
127+
Increments release minor version number by 1 (useful when you start working on next release version) and clear alpha,
128+
beta, rc and patch number.
129+
103130
```sh
104131
$ semver up minor
105132
v1.1.0
106133
```
107134

108135
Before you upgrade the minor version the next versions will be generated based on this new minor version.
136+
109137
```sh
110138
$ semver up alpha
111139
v1.1.0-alpha.1
@@ -118,13 +146,17 @@ v1.1.0-rc.1
118146
```
119147

120148
#### Major
121-
Upgrades the current version to the next major version (when you starts working on a new version with branking changes) and clear alpha, beta, rc, patch and minor number.
149+
150+
Upgrades the current version to the next major version (when you starts working on a new version with branking changes)
151+
and clear alpha, beta, rc, patch and minor number.
152+
122153
```sh
123154
$ semver up major
124155
v2.0.0
125156
```
126157

127158
Before them, your next versions will be generated based on this new version.
159+
128160
```sh
129161
$ semver up alpha
130162
v2.0.0-alpha.1

go.mod

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,32 @@
11
module github.com/maykonlf/semver-cli
22

3-
go 1.13
3+
go 1.17
44

55
require (
6-
github.com/pelletier/go-toml v1.6.0 // indirect
76
github.com/smartystreets/goconvey v1.6.4
8-
github.com/spf13/afero v1.2.2 // indirect
9-
github.com/spf13/cobra v0.0.5
7+
github.com/spf13/cobra v1.4.0
8+
github.com/spf13/viper v1.10.1
9+
)
10+
11+
require (
12+
github.com/fsnotify/fsnotify v1.5.1 // indirect
13+
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
14+
github.com/hashicorp/hcl v1.0.0 // indirect
15+
github.com/inconshreveable/mousetrap v1.0.0 // indirect
16+
github.com/jtolds/gls v4.20.0+incompatible // indirect
17+
github.com/kr/pretty v0.2.0 // indirect
18+
github.com/magiconair/properties v1.8.6 // indirect
19+
github.com/mitchellh/mapstructure v1.4.3 // indirect
20+
github.com/pelletier/go-toml v1.9.4 // indirect
21+
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d // indirect
22+
github.com/spf13/afero v1.8.2 // indirect
23+
github.com/spf13/cast v1.4.1 // indirect
1024
github.com/spf13/jwalterweatherman v1.1.0 // indirect
1125
github.com/spf13/pflag v1.0.5 // indirect
12-
github.com/spf13/viper v1.6.1
13-
golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9 // indirect
14-
golang.org/x/text v0.3.2 // indirect
15-
gopkg.in/yaml.v2 v2.2.7
26+
github.com/subosito/gotenv v1.2.0 // indirect
27+
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect
28+
golang.org/x/text v0.3.7 // indirect
29+
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
30+
gopkg.in/ini.v1 v1.66.4 // indirect
31+
gopkg.in/yaml.v2 v2.4.0 // indirect
1632
)

0 commit comments

Comments
 (0)