--- project_name: {{ project_name }} env: - CGO_ENABLED=0 - PKG={{ module_name }} {% raw %} dockers: # see details at https://goreleaser.com/customization/docker/ - use: buildx goos: linux goarch: amd64 image_templates: - "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}:{{ .Tag }}-amd64" dockerfile: Dockerfile.goreleaser build_flag_templates: - "--platform=linux/amd64" - "--label=org.opencontainers.image.created={{.Date}}" - "--label=org.opencontainers.image.name={{.ProjectName}}" - "--label=org.opencontainers.image.revision={{.FullCommit}}" - "--label=org.opencontainers.image.version={{.Version}}" - "--label=org.opencontainers.image.source={{.GitURL}}" - "--builder={{ .Env.DOCKER_CONTEXT }}" - use: buildx goos: linux goarch: arm64 image_templates: - "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}:{{ .Tag }}-arm64" dockerfile: Dockerfile.goreleaser build_flag_templates: - "--platform=linux/arm64" - "--label=org.opencontainers.image.created={{.Date}}" - "--label=org.opencontainers.image.name={{.ProjectName}}" - "--label=org.opencontainers.image.revision={{.FullCommit}}" - "--label=org.opencontainers.image.version={{.Version}}" - "--label=org.opencontainers.image.source={{.GitURL}}" - "--builder={{ .Env.DOCKER_CONTEXT }}" docker_manifests: - name_template: "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}:{{ .Tag }}" image_templates: - "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}:{{ .Tag }}-amd64" - "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}:{{ .Tag }}-arm64" docker_signs: - cmd: cosign artifacts: all output: true args: - "sign" - "--a" - "git_sha={{.FullCommit}}" - "ghcr.io/{{ .Env.GITHUB_REPOSITORY }}@${digest}" - "--yes" before: hooks: - go mod tidy - go generate ./... builds: - main: ./ id: main binary: main-{{ .Os }}-{{ .Arch }} ldflags: # See https://goreleaser.com/customization/templates/#common-fields for field definitions - -X {{.Env.PKG}}.Commit={{.FullCommit}} - -X {{.Env.PKG}}.Date={{.Date}} - -X {{.Env.PKG}}.Version={{.Summary}} goos: [ 'darwin', 'linux', 'windows' ] goarch: - amd64 - arm64 - arm ignore: - goos: windows goarch: arm64 - goos: windows goarch: arm universal_binaries: - replace: true name_template: main id: main ids: - main sboms: - id: bins cmd: trivy args: ["fs", ".", "--format", "spdx-json", "--output", "${artifact}.spdx.sbom.json"] artifacts: binary documents: - "${artifact}.spdx.sbom.json" signs: - id: cosign-keyless artifacts: checksum signature: "${artifact}-keyless.sig" certificate: "${artifact}-keyless.pem" cmd: cosign args: - "sign-blob" - "--yes" - "--output-signature" - "${artifact}-keyless.sig" - "--output-certificate" - "${artifact}-keyless.pem" - "${artifact}" output: true archives: - format: binary name_template: "{{ .Binary }}" allow_different_binary_count: true checksum: name_template: "{{ .ProjectName }}_checksums.txt" snapshot: name_template: SNAPSHOT-{{ .ShortCommit }} changelog: sort: asc filters: exclude: - "^docs:" - "^test:" release: prerelease: auto draft: false replace_existing_draft: true # The lines beneath this are called `modelines`. See `:help modeline` # yaml-language-server: $schema=https://goreleaser.com/static/schema.json # vim: set ts=2 sw=2 tw=0 fo=cnqoj {% endraw %}