cuelang.org/go@v0.10.1/internal/ci/goreleaser/goreleaser.cue (about)

     1  package goreleaser
     2  
     3  config: {
     4  	#latest: bool @tag(latest, type=bool)
     5  
     6  	project_name: "cue"
     7  	// Note that gomod.proxy is ignored by `goreleaser release --snapshot`,
     8  	// which we use in CI to test the goreleaser config and build,
     9  	// as --snapshot is meant for entirely local builds without a git tag.
    10  	gomod: proxy: true
    11  
    12  	// Template based on common settings
    13  	builds: [...{
    14  		env: *[
    15  			"CGO_ENABLED=0",
    16  		] | _
    17  		ldflags: *[
    18  			"-s -w",
    19  		] | _
    20  		flags: *[
    21  			"-trimpath",
    22  		] | _
    23  		// Note that goreleaser says that id defaults to the binary name,
    24  		// but it then complains about "cue" being duplicate even though we use "cue" and "cuepls".
    25  		id:            binary
    26  		main:          string
    27  		binary:        string
    28  		mod_timestamp: *'{{ .CommitTimestamp }}' | _
    29  		goos: *[
    30  			"darwin",
    31  			"linux",
    32  			"windows",
    33  		] | _
    34  		goarch: *[
    35  			"amd64",
    36  			"arm64",
    37  		] | _
    38  	}]
    39  
    40  	builds: [
    41  		{main: "./cmd/cue", binary: "cue"},
    42  		{main: "./cmd/cuepls", binary: "cuepls"},
    43  	]
    44  
    45  	archives: [{
    46  		name_template: "{{ .ProjectName }}_{{ .Tag }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}"
    47  		files: [
    48  			"LICENSE",
    49  			"README.md",
    50  			"doc/tutorial/**/*",
    51  			"doc/ref/spec.md",
    52  		]
    53  		format_overrides: [{
    54  			goos:   "windows"
    55  			format: "zip"
    56  		}]
    57  	}]
    58  	release: {
    59  		disable:    false
    60  		prerelease: "auto"
    61  
    62  		// We manually write the release notes, so they need to be added to a release on GitHub.
    63  		// We don't want to create the release from scratch without goreleaser,
    64  		// since goreleaser takes care of creating and uploading the release archives.
    65  		// We also don't want the release to be fully published by goreleaser,
    66  		// as otherwise the notification emails go out with the release notes missing.
    67  		// For those reasons, let goreleaser create the release, but leaving it as a draft.
    68  		draft: true
    69  	}
    70  	checksum: name_template: "checksums.txt"
    71  	snapshot: name_template: "{{ .Tag }}-next"
    72  	// As explained above, we write our own release notes.
    73  	changelog: disable: true
    74  
    75  	brews: [{
    76  		if !#latest {
    77  			skip_upload: true
    78  		}
    79  		repository: {
    80  			owner: "cue-lang"
    81  			name:  "homebrew-tap"
    82  		}
    83  		commit_author: {
    84  			name:  "cueckoo"
    85  			email: "noreply@cuelang.org"
    86  		}
    87  		homepage:    "https://cuelang.org"
    88  		description: "CUE is an open source data constraint language which aims to simplify tasks involving defining and using data."
    89  		test: """
    90  			system \"#{bin}/cue version\"
    91  
    92  			"""
    93  	}]
    94  
    95  	dockers: [{
    96  		image_templates: [
    97  			"docker.io/cuelang/cue:{{ .Version }}-amd64",
    98  		]
    99  		dockerfile: "cmd/cue/Dockerfile"
   100  		use:        "buildx"
   101  		build_flag_templates: [
   102  			"--platform=linux/amd64",
   103  			"--label=org.opencontainers.image.title={{ .ProjectName }}",
   104  			"--label=org.opencontainers.image.description={{ .ProjectName }}",
   105  			"--label=org.opencontainers.image.url=https://github.com/cue-lang/cue",
   106  			"--label=org.opencontainers.image.source=https://github.com/cue-lang/cue",
   107  			"--label=org.opencontainers.image.version={{ .Version }}",
   108  			"--label=org.opencontainers.image.created={{ time \"2006-01-02T15:04:05Z07:00\" }}",
   109  			"--label=org.opencontainers.image.revision={{ .FullCommit }}",
   110  			"--label=org.opencontainers.image.licenses=Apache 2.0",
   111  		]
   112  	}, {
   113  		image_templates: [
   114  			"docker.io/cuelang/cue:{{ .Version }}-arm64",
   115  		]
   116  		goarch:     "arm64"
   117  		dockerfile: "cmd/cue/Dockerfile"
   118  		use:        "buildx"
   119  		build_flag_templates: [
   120  			"--platform=linux/arm64",
   121  			"--label=org.opencontainers.image.title={{ .ProjectName }}",
   122  			"--label=org.opencontainers.image.description={{ .ProjectName }}",
   123  			"--label=org.opencontainers.image.url=https://github.com/cue-lang/cue",
   124  			"--label=org.opencontainers.image.source=https://github.com/cue-lang/cue",
   125  			"--label=org.opencontainers.image.version={{ .Version }}",
   126  			"--label=org.opencontainers.image.created={{ time \"2006-01-02T15:04:05Z07:00\" }}",
   127  			"--label=org.opencontainers.image.revision={{ .FullCommit }}",
   128  			"--label=org.opencontainers.image.licenses=Apache 2.0",
   129  		]
   130  	}]
   131  
   132  	docker_manifests: [
   133  		{
   134  			name_template: "docker.io/cuelang/cue:{{ .Version }}"
   135  			image_templates: [
   136  				"docker.io/cuelang/cue:{{ .Version }}-amd64",
   137  				"docker.io/cuelang/cue:{{ .Version }}-arm64",
   138  			]
   139  		},
   140  		if #latest {
   141  			name_template: "docker.io/cuelang/cue:latest"
   142  			image_templates: [
   143  				"docker.io/cuelang/cue:{{ .Version }}-amd64",
   144  				"docker.io/cuelang/cue:{{ .Version }}-arm64",
   145  			]
   146  		},
   147  	]
   148  }