From 3ee9700c2f3b2c0122c4855bd2853720fe97b8e0 Mon Sep 17 00:00:00 2001 From: Felix Furrer Date: Sat, 20 Aug 2022 15:33:07 +0200 Subject: [PATCH] Prepare v2.0.0 release --- .github/workflows/ci.yml | 1 + CHANGELOG.md | 11 +++++++++++ README.md | 10 ++++++---- build/package/.goreleaser.yaml | 6 +++--- cmd/semver/compare.go | 2 +- cmd/semver/filter.go | 6 +++--- cmd/semver/format.go | 4 ++-- cmd/semver/major.go | 4 ++-- cmd/semver/minor.go | 4 ++-- cmd/semver/patch.go | 4 ++-- cmd/semver/sort.go | 4 ++-- cmd/semver/validate.go | 4 ++-- cmd/semver/version.go | 2 +- go.mod | 4 +--- internal/pkg/number/number_test.go | 2 +- internal/pkg/predicate/predicate_test.go | 2 +- pkg/semver/builder_test.go | 2 +- pkg/semver/semver.go | 2 +- pkg/semver/semver_test.go | 4 ++-- scripts/version | 4 ++-- tasks/GoTasks.yml | 6 +++--- 21 files changed, 50 insertions(+), 38 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6bf5631..58b55b4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,7 @@ jobs: - name: Setup task run: | + set -euo pipefail sudo bash -c 'curl -fsSL https://taskfile.dev/install.sh | bash -s -- -b /usr/local/bin v${{ env.TASK_VERSION }}' - name: Setup GoReleaser diff --git a/CHANGELOG.md b/CHANGELOG.md index a44e96d..e7cc1f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ### Security +## [2.0.0] - 2022-09-03 + +### Added + +- Added flag (`-r/--reverse) to sort in reverse order +- Added additional flags to the filter command + +### Changed + +- Changed the default behaviour of the filter command. Pre-release versions and versions containing build metadata are no longer printed by default. + ## [1.8.0] - 2022-08-25 ### Changed diff --git a/README.md b/README.md index ebf8982..3c6c38a 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ scoop install semver ### Build from source ```shell -go install github.com/ffurrer2/semver/cmd/semver@latest +go install github.com/ffurrer2/semver/v2/cmd/semver@latest ``` ## Usage @@ -44,6 +44,7 @@ Usage: Available Commands: compare Compare semantic versions + completion Generate the autocompletion script for the specified shell filter Filter semantic versions format Format and print semantic versions help Help about any command @@ -107,9 +108,10 @@ $ echo $? ```console $ semver version -semver version 1.0.0 -commit: 224394b9d709277fe5e4965a6633535c597cd2ed -built at: 2020-06-18T20:22:25Z +semver version: 1.8.0 +built at: 2022-08-25T12:40:39Z +git commit: 10c573e1ec0a6aa302c6ace2d995793139ebc1e6 +git tree state: clean ``` ## License diff --git a/build/package/.goreleaser.yaml b/build/package/.goreleaser.yaml index 826c61b..ec81b40 100644 --- a/build/package/.goreleaser.yaml +++ b/build/package/.goreleaser.yaml @@ -93,9 +93,9 @@ builds: gobinary: go command: build ldflags: - - -X github.com/ffurrer2/semver/internal/pkg/app.version={{.Version}} - - -X github.com/ffurrer2/semver/internal/pkg/app.date={{.Date}} - - -X github.com/ffurrer2/semver/internal/pkg/app.commit={{.Commit}} + - -X github.com/ffurrer2/semver/v2/internal/pkg/app.version={{.Version}} + - -X github.com/ffurrer2/semver/v2/internal/pkg/app.date={{.Date}} + - -X github.com/ffurrer2/semver/v2/internal/pkg/app.commit={{.Commit}} - -s - -w flags: diff --git a/cmd/semver/compare.go b/cmd/semver/compare.go index 6e081a3..ea17571 100644 --- a/cmd/semver/compare.go +++ b/cmd/semver/compare.go @@ -5,7 +5,7 @@ package main import ( "os" - "github.com/ffurrer2/semver/pkg/semver" + "github.com/ffurrer2/semver/v2/pkg/semver" "github.com/spf13/cobra" ) diff --git a/cmd/semver/filter.go b/cmd/semver/filter.go index 8522734..e4049b9 100644 --- a/cmd/semver/filter.go +++ b/cmd/semver/filter.go @@ -3,9 +3,9 @@ package main import ( - "github.com/ffurrer2/semver/internal/pkg/cli" - "github.com/ffurrer2/semver/internal/pkg/predicate" - "github.com/ffurrer2/semver/pkg/semver" + "github.com/ffurrer2/semver/v2/internal/pkg/cli" + "github.com/ffurrer2/semver/v2/internal/pkg/predicate" + "github.com/ffurrer2/semver/v2/pkg/semver" "github.com/spf13/cobra" ) diff --git a/cmd/semver/format.go b/cmd/semver/format.go index 87e9b74..fa6e8b7 100644 --- a/cmd/semver/format.go +++ b/cmd/semver/format.go @@ -6,8 +6,8 @@ import ( "os" "text/template" - "github.com/ffurrer2/semver/internal/pkg/cli" - "github.com/ffurrer2/semver/pkg/semver" + "github.com/ffurrer2/semver/v2/internal/pkg/cli" + "github.com/ffurrer2/semver/v2/pkg/semver" "github.com/spf13/cobra" ) diff --git a/cmd/semver/major.go b/cmd/semver/major.go index 0d2b4c5..db262f7 100644 --- a/cmd/semver/major.go +++ b/cmd/semver/major.go @@ -5,8 +5,8 @@ package main import ( "os" - "github.com/ffurrer2/semver/internal/pkg/cli" - "github.com/ffurrer2/semver/pkg/semver" + "github.com/ffurrer2/semver/v2/internal/pkg/cli" + "github.com/ffurrer2/semver/v2/pkg/semver" "github.com/spf13/cobra" ) diff --git a/cmd/semver/minor.go b/cmd/semver/minor.go index c365509..38880b0 100644 --- a/cmd/semver/minor.go +++ b/cmd/semver/minor.go @@ -5,8 +5,8 @@ package main import ( "os" - "github.com/ffurrer2/semver/internal/pkg/cli" - "github.com/ffurrer2/semver/pkg/semver" + "github.com/ffurrer2/semver/v2/internal/pkg/cli" + "github.com/ffurrer2/semver/v2/pkg/semver" "github.com/spf13/cobra" ) diff --git a/cmd/semver/patch.go b/cmd/semver/patch.go index 3d5b2cc..7239aea 100644 --- a/cmd/semver/patch.go +++ b/cmd/semver/patch.go @@ -5,8 +5,8 @@ package main import ( "os" - "github.com/ffurrer2/semver/internal/pkg/cli" - "github.com/ffurrer2/semver/pkg/semver" + "github.com/ffurrer2/semver/v2/internal/pkg/cli" + "github.com/ffurrer2/semver/v2/pkg/semver" "github.com/spf13/cobra" ) diff --git a/cmd/semver/sort.go b/cmd/semver/sort.go index ffe7ea5..0cca8a4 100644 --- a/cmd/semver/sort.go +++ b/cmd/semver/sort.go @@ -6,8 +6,8 @@ import ( "os" "sort" - "github.com/ffurrer2/semver/internal/pkg/cli" - "github.com/ffurrer2/semver/pkg/semver" + "github.com/ffurrer2/semver/v2/internal/pkg/cli" + "github.com/ffurrer2/semver/v2/pkg/semver" "github.com/spf13/cobra" ) diff --git a/cmd/semver/validate.go b/cmd/semver/validate.go index 060b779..81282c0 100644 --- a/cmd/semver/validate.go +++ b/cmd/semver/validate.go @@ -5,8 +5,8 @@ package main import ( "os" - "github.com/ffurrer2/semver/internal/pkg/cli" - "github.com/ffurrer2/semver/pkg/semver" + "github.com/ffurrer2/semver/v2/internal/pkg/cli" + "github.com/ffurrer2/semver/v2/pkg/semver" "github.com/spf13/cobra" ) diff --git a/cmd/semver/version.go b/cmd/semver/version.go index 85bf552..d2b1be2 100644 --- a/cmd/semver/version.go +++ b/cmd/semver/version.go @@ -3,7 +3,7 @@ package main import ( - "github.com/ffurrer2/semver/internal/pkg/app" + "github.com/ffurrer2/semver/v2/internal/pkg/app" "github.com/spf13/cobra" ) diff --git a/go.mod b/go.mod index 563ac32..1105cac 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,8 @@ // SPDX-License-Identifier: MIT -module github.com/ffurrer2/semver +module github.com/ffurrer2/semver/v2 go 1.19 -retract v1.7.0 // Published accidentally - require ( github.com/onsi/ginkgo/v2 v2.1.6 github.com/onsi/gomega v1.20.2 diff --git a/internal/pkg/number/number_test.go b/internal/pkg/number/number_test.go index c40638f..005ecb8 100644 --- a/internal/pkg/number/number_test.go +++ b/internal/pkg/number/number_test.go @@ -6,7 +6,7 @@ import ( "fmt" "math/bits" - "github.com/ffurrer2/semver/internal/pkg/number" + "github.com/ffurrer2/semver/v2/internal/pkg/number" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/internal/pkg/predicate/predicate_test.go b/internal/pkg/predicate/predicate_test.go index 879264a..5c3a704 100644 --- a/internal/pkg/predicate/predicate_test.go +++ b/internal/pkg/predicate/predicate_test.go @@ -3,7 +3,7 @@ package predicate_test import ( - "github.com/ffurrer2/semver/internal/pkg/predicate" + "github.com/ffurrer2/semver/v2/internal/pkg/predicate" . "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega" ) diff --git a/pkg/semver/builder_test.go b/pkg/semver/builder_test.go index ec352ff..14e7942 100644 --- a/pkg/semver/builder_test.go +++ b/pkg/semver/builder_test.go @@ -3,7 +3,7 @@ package semver_test import ( - "github.com/ffurrer2/semver/pkg/semver" + "github.com/ffurrer2/semver/v2/pkg/semver" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/pkg/semver/semver.go b/pkg/semver/semver.go index 443d108..c0c5d5c 100644 --- a/pkg/semver/semver.go +++ b/pkg/semver/semver.go @@ -8,7 +8,7 @@ import ( "regexp" "strings" - "github.com/ffurrer2/semver/internal/pkg/number" + "github.com/ffurrer2/semver/v2/internal/pkg/number" ) const ( diff --git a/pkg/semver/semver_test.go b/pkg/semver/semver_test.go index 1f9506f..9f7ed95 100644 --- a/pkg/semver/semver_test.go +++ b/pkg/semver/semver_test.go @@ -7,8 +7,8 @@ import ( "sort" "strings" - "github.com/ffurrer2/semver/internal/pkg/number" - "github.com/ffurrer2/semver/pkg/semver" + "github.com/ffurrer2/semver/v2/internal/pkg/number" + "github.com/ffurrer2/semver/v2/pkg/semver" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/scripts/version b/scripts/version index 4ec7648..4591653 100755 --- a/scripts/version +++ b/scripts/version @@ -78,8 +78,8 @@ branch_name() { branch_name="$(git rev-parse --abbrev-ref HEAD)" if [[ ${branch_name} == "HEAD" ]]; then # Try to determine branch name from GITHUB_REF environment variable (GitHub Actions) - if [[ -n ${GITHUB_REF:-} ]]; then - branch_name="${GITHUB_REF/refs\/heads\//}" + if [[ -n ${GITHUB_REF_NAME:-} ]]; then + branch_name="${GITHUB_REF_NAME}" # Try to determine branch name from BRANCH_NAME environment variable (Jenkins) elif [[ -n ${BRANCH_NAME:-} ]]; then branch_name="${BRANCH_NAME}" diff --git a/tasks/GoTasks.yml b/tasks/GoTasks.yml index 44fdf13..afb2186 100644 --- a/tasks/GoTasks.yml +++ b/tasks/GoTasks.yml @@ -5,9 +5,9 @@ version: '3' vars: GO_BUILD_ENV: CGO_ENABLED=0 LDFLAGS: >- - -X github.com/ffurrer2/semver/internal/pkg/app.version={{.BUILD_VERSION}} - -X github.com/ffurrer2/semver/internal/pkg/app.date={{.BUILD_DATE}} - -X github.com/ffurrer2/semver/internal/pkg/app.commit={{.GIT_SHA}} + -X github.com/ffurrer2/semver/v2/internal/pkg/app.version={{.BUILD_VERSION}} + -X github.com/ffurrer2/semver/v2/internal/pkg/app.date={{.BUILD_DATE}} + -X github.com/ffurrer2/semver/v2/internal/pkg/app.commit={{.GIT_SHA}} -s -w tasks: