ejoffe / spr

Stacked Pull Requests on GitHub
MIT License
717 stars 65 forks source link

.goreleaser.yml error: field replacements not found in type config.Archive #339

Closed kwk closed 1 year ago

kwk commented 1 year ago

TL;DR;

archives.replacements has been deprecated and is now removed in recent goreleaser https://goreleaser.com/deprecations/#archivesreplacements and needs to be fixed in the .goreleaser.yml.

Details

When running make I get this error:

$ make
goreleaser --snapshot --skip-publish --rm-dist
Flag --rm-dist has been deprecated, please use --clean instead
  • starting release...
  • loading config file                              file=.goreleaser.yml
  ⨯ release failed after 0s                  error=yaml: unmarshal errors:
  line 36: field replacements not found in type config.Archive
make: *** [Makefile:3: bin] Error 1

Checking the YAML with goreleaser check produces the same error:

$ goreleaser check
  • loading config file                              file=.goreleaser.yml
  ⨯ command failed                                   error=yaml: unmarshal errors:
  line 36: field replacements not found in type config.Archive

I figured I check the JSONSchema (goreleaser jsonschema) and indeed it looks like the Archive type has no property named replacements:

{
    "Archive": {
                "properties": {
                    "id": {
                        "type": "string"
                    },
                    "builds": {
                        "items": {
                            "type": "string"
                        },
                        "type": "array"
                    },
                    "builds_info": {
                        "$ref": "#/$defs/FileInfo"
                    },
                    "name_template": {
                        "type": "string"
                    },
                    "format": {
                        "type": "string",
                        "enum": [
                            "tar",
                            "tgz",
                            "tar.gz",
                            "zip",
                            "gz",
                            "tar.xz",
                            "txz",
                            "binary"
                        ],
                        "default": "tar.gz"
                    },
                    "format_overrides": {
                        "items": {
                            "$ref": "#/$defs/FormatOverride"
                        },
                        "type": "array"
                    },
                    "wrap_in_directory": {
                        "oneOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "boolean"
                            }
                        ]
                    },
                    "strip_parent_binary_folder": {
                        "type": "boolean"
                    },
                    "rlcp": {
                        "oneOf": [
                            {
                                "type": "string"
                            },
                            {
                                "type": "boolean"
                            }
                        ],
                        "description": "you can now remove this"
                    },
                    "files": {
                        "items": {
                            "$ref": "#/$defs/File"
                        },
                        "type": "array"
                    },
                    "meta": {
                        "type": "boolean"
                    },
                    "allow_different_binary_count": {
                        "type": "boolean"
                    }
                },
                "additionalProperties": false,
                "type": "object"
            }
}

The error only occurs since a recent goreleaser version but the archives.replacements field was deprecated before: https://goreleaser.com/deprecations/#archivesreplacements

Apparently others have the same problem: https://github.com/pulumi/pulumi/issues/13312.

LazarenkoA commented 12 months ago

I have a recurring issue, here's my configuration: https://github.com/LazarenkoA/prometheus_1C_exporter/blob/master/.github/workflows/releaser.yaml What should I do to resolve the error?