Skip to content

Commit

Permalink
Merge branch 'release/0.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
tomodian committed Sep 18, 2022
2 parents ab06652 + 2a3a2fb commit e989feb
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 164 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.13.0] - 2022-09-18

### Added

- Added test for main.go

### Changed

- More comments on functions
- Changed to Go 1.17

### Removed

- Removed unused git handler

## [0.12.0] - 2022-09-03

### Added
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Release

[![Go Reference](https://pkg.go.dev/badge/github.com/tomodian/release.svg)](https://pkg.go.dev/github.com/tomodian/release)
![Test on Linux](https://github.com/tomodian/release/workflows/Test%20on%20Linux/badge.svg?branch=develop)
[![Release](https://github.com/tomodian/release/actions/workflows/release.yml/badge.svg)](https://github.com/tomodian/release/actions/workflows/release.yml)
[![codecov](https://codecov.io/gh/tomodian/release/branch/develop/graph/badge.svg)](https://codecov.io/gh/tomodian/release)
Expand Down
6 changes: 4 additions & 2 deletions files/glob.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ func ignore(path string) bool {
return false
}

// Glob seeks for all CHANGELOG.md in given directory.
// Glob seeks for all changelog files from the given directory, and returns a slice of absolute file path.
// This function excludes common auto-generated directories, such as node_modules and coverage reports.
func Glob(d string) []string {
p := fmt.Sprintf("%s/**/CHANGELOG.md", d)

Expand Down Expand Up @@ -95,7 +96,8 @@ func Glob(d string) []string {
return outs
}

// Rel returns relative path.
// Rel takes an arbitary path, and returns relative path from the current working directory.
// It will terminate the context when the given path is broken.
func Rel(path string) string {
wd, err := os.Getwd()

Expand Down
2 changes: 1 addition & 1 deletion files/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io/ioutil"
)

// Read returns string of target path.
// Read file content of given path.
func Read(path string) (string, error) {
if path == "" {
return "", errors.New("given path is empty")
Expand Down
30 changes: 28 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/tomodian/release

go 1.14
go 1.17

require (
github.com/blang/semver/v4 v4.0.0
Expand All @@ -9,8 +9,34 @@ require (
github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb
github.com/go-git/go-git/v5 v5.3.0
github.com/manifoldco/promptui v0.8.0
github.com/mitchellh/gox v1.0.1 // indirect
github.com/stretchr/testify v1.7.0
github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31
github.com/urfave/cli/v2 v2.3.0
)

require (
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d // indirect
github.com/emirpasic/gods v1.12.0 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.1.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/lunixbochs/vtclean v0.0.0-20180621232353-2d01aacdc34a // indirect
github.com/mattn/go-colorable v0.0.9 // indirect
github.com/mattn/go-isatty v0.0.4 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/russross/blackfriday/v2 v2.0.1 // indirect
github.com/sergi/go-diff v1.1.0 // indirect
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
github.com/xanzy/ssh-agent v0.3.0 // indirect
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 // indirect
golang.org/x/net v0.0.0-20210326060303-6b1517762897 // indirect
golang.org/x/sys v0.0.0-20210324051608-47abb6519492 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
)
7 changes: 0 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb h1:IT4JYU7k4ikYg1SCxNI1/Tieq/NFvh6dzLdgi7eu0tM=
github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb/go.mod h1:bH6Xx7IW64qjjJq8M2u4dxNaBiDfKK+z/3eGDpXEQhc=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
Expand All @@ -43,8 +42,6 @@ github.com/go-git/go-git/v5 v5.3.0 h1:8WKMtJR2j8RntEXR/uvTKagfEt4GYlwQ7mntE4+0GW
github.com/go-git/go-git/v5 v5.3.0/go.mod h1:xdX4bWJ48aOrdhnl2XqHYstHbbp6+LFS4r4X+lNVprw=
github.com/google/go-cmp v0.3.0 h1:crn/baboCvb5fXaQ0IJ1SGTsTVrWpDsCWC8EGETZijY=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/hashicorp/go-version v1.0.0 h1:21MVWPKDphxa7ineQQTrCU5brh7OuVVAzGOCnnCPtE8=
github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
Expand Down Expand Up @@ -72,10 +69,6 @@ github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/gox v1.0.1 h1:x0jD3dcHk9a9xPSDN6YEL4xL6Qz0dvNYm8yZqui5chI=
github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4=
github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY=
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down
11 changes: 11 additions & 0 deletions main_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package main

import (
"testing"

"github.com/stretchr/testify/assert"
)

func TestMain(t *testing.T) {
assert.NotPanics(t, main)
}
69 changes: 0 additions & 69 deletions parser/git.go

This file was deleted.

77 changes: 0 additions & 77 deletions parser/git_test.go

This file was deleted.

3 changes: 2 additions & 1 deletion parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import (
"github.com/blang/semver/v4"
)

// List of tags.
const (
// Unreleased tag is defined in keepachangelog 1.0.0.
// https://keepachangelog.com/en/1.0.0/
Unreleased = "[Unreleased]"
unreleasedHeading = "## [Unreleased]"
)
Expand Down
12 changes: 7 additions & 5 deletions parser/semver.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ func (c SemanticVersion) IsEqual(in *SemanticVersion) bool {
return false
}

if c.Major == in.Major && c.Minor == in.Minor && c.Patch == in.Patch {
return true
}

return false
return c.Major == in.Major && c.Minor == in.Minor && c.Patch == in.Patch
}

// IsGreater compares internal version with given version.
Expand Down Expand Up @@ -85,6 +81,12 @@ func (c SemanticVersion) String() string {
}

// Increment version according to given type.
// The type must be one of Major/Minor/Patch.
//
// Given 1.2.3 as example:
// - Increment(Major) --> 2.2.3
// - Increment(Minor) --> 1.3.3
// - Increment(Patch) --> 1.2.4
func (c SemanticVersion) Increment(in VersionType) SemanticVersion {
switch in {
case MajorVersion:
Expand Down

0 comments on commit e989feb

Please sign in to comment.