1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-09-16 09:26:52 +02:00

feat: removes deprecated non-semver allowance (#2503)

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker
2021-09-23 00:39:28 -03:00
committed by GitHub
parent 421b92f375
commit 833db79bda
5 changed files with 12 additions and 57 deletions

View File

@@ -81,9 +81,9 @@ func newReleaseCmd() *releaseCmd {
cmd.Flags().BoolVar(&root.opts.snapshot, "snapshot", false, "Generate an unversioned snapshot release, skipping all validations and without publishing any artifacts (implies --skip-publish, --skip-announce and --skip-validate)") cmd.Flags().BoolVar(&root.opts.snapshot, "snapshot", false, "Generate an unversioned snapshot release, skipping all validations and without publishing any artifacts (implies --skip-publish, --skip-announce and --skip-validate)")
cmd.Flags().BoolVar(&root.opts.skipPublish, "skip-publish", false, "Skips publishing artifacts") cmd.Flags().BoolVar(&root.opts.skipPublish, "skip-publish", false, "Skips publishing artifacts")
cmd.Flags().BoolVar(&root.opts.skipAnnounce, "skip-announce", false, "Skips announcing releases (implies --skip-validate)") cmd.Flags().BoolVar(&root.opts.skipAnnounce, "skip-announce", false, "Skips announcing releases (implies --skip-validate)")
cmd.Flags().BoolVar(&root.opts.skipSign, "skip-sign", false, "Skips signing the artifacts") cmd.Flags().BoolVar(&root.opts.skipSign, "skip-sign", false, "Skips signing artifacts")
cmd.Flags().BoolVar(&root.opts.skipValidate, "skip-validate", false, "Skips several sanity checks") cmd.Flags().BoolVar(&root.opts.skipValidate, "skip-validate", false, "Skips git checks")
cmd.Flags().BoolVar(&root.opts.rmDist, "rm-dist", false, "Remove the dist folder before building") cmd.Flags().BoolVar(&root.opts.rmDist, "rm-dist", false, "Removes the dist folder")
cmd.Flags().IntVarP(&root.opts.parallelism, "parallelism", "p", 0, "Amount tasks to run concurrently (default: number of CPUs)") cmd.Flags().IntVarP(&root.opts.parallelism, "parallelism", "p", 0, "Amount tasks to run concurrently (default: number of CPUs)")
cmd.Flags().DurationVar(&root.opts.timeout, "timeout", 30*time.Minute, "Timeout to the entire release process") cmd.Flags().DurationVar(&root.opts.timeout, "timeout", 30*time.Minute, "Timeout to the entire release process")
cmd.Flags().BoolVar(&root.opts.deprecated, "deprecated", false, "Force print the deprecation message - tests only") cmd.Flags().BoolVar(&root.opts.deprecated, "deprecated", false, "Force print the deprecation message - tests only")

View File

@@ -4,8 +4,6 @@ import (
"fmt" "fmt"
"github.com/Masterminds/semver/v3" "github.com/Masterminds/semver/v3"
"github.com/goreleaser/goreleaser/internal/deprecate"
"github.com/goreleaser/goreleaser/internal/pipe"
"github.com/goreleaser/goreleaser/pkg/context" "github.com/goreleaser/goreleaser/pkg/context"
) )
@@ -21,19 +19,6 @@ func (Pipe) String() string {
func (Pipe) Run(ctx *context.Context) error { func (Pipe) Run(ctx *context.Context) error {
sv, err := semver.NewVersion(ctx.Git.CurrentTag) sv, err := semver.NewVersion(ctx.Git.CurrentTag)
if err != nil { if err != nil {
if ctx.Snapshot || ctx.SkipValidate {
deprecate.NoticeCustom(
ctx,
"skipping-semver-validations",
fmt.Sprintf("'%s' is not SemVer-compatible and may cause other issues in the pipeline, check {{ .URL }} for more info", ctx.Git.CurrentTag),
)
}
if ctx.Snapshot {
return pipe.ErrSnapshotEnabled
}
if ctx.SkipValidate {
return pipe.ErrSkipValidateEnabled
}
return fmt.Errorf("failed to parse tag '%s' as semver: %w", ctx.Git.CurrentTag, err) return fmt.Errorf("failed to parse tag '%s' as semver: %w", ctx.Git.CurrentTag, err)
} }
ctx.Semver = context.Semver{ ctx.Semver = context.Semver{

View File

@@ -3,8 +3,6 @@ package semver
import ( import (
"testing" "testing"
"github.com/goreleaser/goreleaser/internal/pipe"
"github.com/goreleaser/goreleaser/pkg/config" "github.com/goreleaser/goreleaser/pkg/config"
"github.com/goreleaser/goreleaser/pkg/context" "github.com/goreleaser/goreleaser/pkg/context"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@@ -33,29 +31,3 @@ func TestInvalidSemver(t *testing.T) {
require.Error(t, err) require.Error(t, err)
require.Contains(t, err.Error(), "failed to parse tag 'aaaav1.5.2-rc1' as semver") require.Contains(t, err.Error(), "failed to parse tag 'aaaav1.5.2-rc1' as semver")
} }
func TestInvalidSemverOnSnapshots(t *testing.T) {
ctx := context.New(config.Project{})
ctx.Git.CurrentTag = "aaaav1.5.2-rc1"
ctx.Snapshot = true
require.EqualError(t, Pipe{}.Run(ctx), pipe.ErrSnapshotEnabled.Error())
require.Equal(t, context.Semver{
Major: 0,
Minor: 0,
Patch: 0,
Prerelease: "",
}, ctx.Semver)
}
func TestInvalidSemverSkipValidate(t *testing.T) {
ctx := context.New(config.Project{})
ctx.Git.CurrentTag = "aaaav1.5.2-rc1"
ctx.SkipValidate = true
require.EqualError(t, Pipe{}.Run(ctx), pipe.ErrSkipValidateEnabled.Error())
require.Equal(t, context.Semver{
Major: 0,
Minor: 0,
Patch: 0,
Prerelease: "",
}, ctx.Semver)
}

View File

@@ -6,7 +6,7 @@ title: Fury.io
The fury.io publisher is a [GoReleaser Pro feature](/pro/). The fury.io publisher is a [GoReleaser Pro feature](/pro/).
You might be able to reproduce some of its behavior on GoReleaser OSS using [custom publishers](/customization/publishers/). You might be able to reproduce some of its behavior on GoReleaser OSS using [custom publishers](/customization/publishers/).
With [GoReleaser Pro](/pro) you can easily create deb and yum repositories on [fury.io][fury]. You can easily create `deb` and `yum` repositories on [fury.io][fury] using GoReleaser.
## Usage ## Usage

View File

@@ -79,16 +79,6 @@ Change this:
use: buildx use: buildx
``` ```
### Skipping SemVer Validations
> since 2021-02-28 (v0.158.0)
GoReleaser skips SemVer validations when run with `--skip-validations` or `--snapshot`.
This causes other problems later, such as [invalid Linux packages](https://github.com/goreleaser/goreleaser/issues/2081).
Because of that, once this deprecation expires, GoReleaser will hard fail on non-semver versions, as stated on our
[limitations page](https://goreleaser.com/limitations/semver/).
### builds for darwin/arm64 ### builds for darwin/arm64
> since 2021-02-17 (v0.157.0) > since 2021-02-17 (v0.157.0)
@@ -112,6 +102,14 @@ If you try to use new versions of GoReleaser with Go 1.15 or older, it will warn
The following options were deprecated in the past and were already removed. The following options were deprecated in the past and were already removed.
### Skipping SemVer Validations
> since 2021-02-28 (v0.158.0), removed 2021-09-22 (v0.180.0)
GoReleaser skips SemVer validations when run with `--skip-validation` or `--snapshot`.
This causes other problems later, such as [invalid Linux packages](https://github.com/goreleaser/goreleaser/issues/2081).
Because of that, once this deprecation expires, GoReleaser will hard fail on non-semver versions, as stated on our [limitations page](https://goreleaser.com/limitations/semver/).
### docker.builds ### docker.builds
> since 2021-01-07 (v0.154.0), removed 2021-08-13 (v0.175.0) > since 2021-01-07 (v0.154.0), removed 2021-08-13 (v0.175.0)