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

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