Skip to content

Commit f324665

Browse files
authored
Merge pull request #17 from wimspaargaren/print-correct-version
Ergo version correction
2 parents a691d6e + a0e7980 commit f324665

File tree

7 files changed

+26
-9
lines changed

7 files changed

+26
-9
lines changed

.golangci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,15 @@ linters:
5252
- gocyclo
5353
- gofmt
5454
- goimports
55-
- golint
55+
- revive
5656
- gosec
5757
- gosimple
5858
- govet
5959
- ineffassign
60-
- interfacer
6160
- lll
6261
- misspell
6362
- nakedret
64-
- scopelint
63+
- exportloopref
6564
- staticcheck
6665
- structcheck
6766
- stylecheck

.goreleaser.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ before:
88
- go generate ./...
99
builds:
1010
- main: ./cmd/cli/main.go
11+
ldflags: -s -w -X main.version="{{.Version}}"
1112
env:
1213
- CGO_ENABLED=0
1314
goos:
@@ -26,7 +27,7 @@ archives:
2627
checksum:
2728
name_template: 'checksums.txt'
2829
snapshot:
29-
name_template: "{{ incpatch .Version }}-next"
30+
name_template: "{{ .Version }}"
3031
changelog:
3132
sort: asc
3233
filters:

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
.PHONY: release
12

23
lint:
34
golangci-lint run -v
@@ -13,3 +14,6 @@ ci-lint:
1314

1415
ci-test:
1516
docker-compose -f ./docker-compose.ci.yaml run ergo-ci make test
17+
18+
release:
19+
goreleaser build --rm-dist --snapshot

cmd/cli/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"github.com/beatlabs/ergo/commands"
55
)
66

7+
var version = "develop"
8+
79
func main() {
8-
commands.Execute()
10+
commands.Execute(version)
911
}

commands/root.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ var (
1515
)
1616

1717
// Execute entry point for commands.
18-
func Execute() {
18+
func Execute(version string) {
1919
rootCommand := setUpCommand()
2020
defineRootCommandProperties(rootCommand)
2121
rootCommand.AddCommand(defineStatusCommand())
2222
rootCommand.AddCommand(defineTagCommand())
23-
rootCommand.AddCommand(defineVersionCommand())
23+
rootCommand.AddCommand(defineVersionCommand(version))
2424
rootCommand.AddCommand(defineDraftCommand())
2525
rootCommand.AddCommand(defineDeployCommand())
2626
if err := rootCommand.Execute(); err != nil {

commands/version.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ import (
66
)
77

88
// defineVersionCommand defines the version command.
9-
func defineVersionCommand() *cobra.Command {
9+
func defineVersionCommand(version string) *cobra.Command {
1010
return &cobra.Command{
1111
Use: "version",
1212
Short: "the version of ergo",
1313
Long: "the version of ergo",
1414
Run: func(cmd *cobra.Command, args []string) {
15-
cli.NewCLI().PrintColorizedLine("Version: ", "0.4.1", cli.WarningType)
15+
cli.NewCLI().PrintColorizedLine("Version: ", version, cli.WarningType)
1616
},
1717
}
1818
}

readme.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,14 @@ You have to use this in order to:
8484
- Information about the draft release body and what will change at the time of the release.
8585

8686
[Sample config file](.ergo.yml.dist)
87+
88+
## Release Ergo
89+
90+
In order to release a new version of Ergo, execute the following steps:
91+
1. Create a new [release](https://github.com/beatlabs/ergo/releases) and publish it
92+
2. Execute
93+
```bash
94+
make release
95+
````
96+
3. Edit the created release and add the content of the `dist` folder
97+
4. Point the README download URL to the latest version

0 commit comments

Comments
 (0)