version: 2 before: hooks: - go mod download - go install github.com/cpuguy83/go-md2man/v2@latest - go-md2man -in README.md -out magellan.1 builds: - binary: magellan main: ./main.go # export GIT_STATE=$(if git diff-index --quiet HEAD --; then echo 'clean'; else echo 'dirty'; fi) # export BUILD_HOST=$(hostname) # export GO_VERSION=$(go version | awk '{print $3}') # export BUILD_USER=$(whoami) ldflags: - "-X github.com/davidallendj/magellan/internal/version.GitCommit={{ .Commit }} \ -X github.com/davidallendj/magellan/internal/version.BuildTime={{ .Timestamp }} \ -X github.com/davidallendj/magellan/internal/version.Version={{ .Version }} \ -X github.com/davidallendj/magellan/internal/version.GitBranch={{ .Branch }} \ -X github.com/davidallendj/magellan/internal/version.GitTag={{ .Tag }} \ -X github.com/davidallendj/magellan/internal/version.GitState={{ .Env.GIT_STATE }} \ -X github.com/davidallendj/magellan/internal/version.BuildHost={{ .Env.BUILD_HOST }} \ -X github.com/davidallendj/magellan/internal/version.GoVersion={{ .Env.GO_VERSION }} \ -X github.com/davidallendj/magellan/internal/version.BuildUser={{ .Env.BUILD_USER }} " tags: - version goos: - linux goarch: - amd64 - arm64 goamd64: - v3 goarm: - 7 env: - CGO_ENABLED=1 - CC={{ if eq .Arch "arm64" }}aarch64-linux-gnu-gcc{{ else }}gcc{{ end }} - CXX={{ if eq .Arch "arm64" }}aarch64-linux-gnu-g++{{ else }}g++{{ end }} archives: - formats: [ 'tar.gz' ] # this name template makes the OS and Arch compatible with the results of uname. name_template: >- {{ .ProjectName }}_ {{- title .Os }}_ {{- if eq .Arch "amd64" }}x86_64 {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}v{{ .Arm }}{{ end }} files: - LICENSE - CHANGELOG.md - README.md - magellan.1 nfpms: - id: magellan formats: - deb - rpm - apk - archlinux maintainer: "David J. Allen " description: "General purpose discovery CLI tool" homepage: "https://git.towk2.me/towk/magellan-ng" license: MIT section: utils priority: optional contents: - src: magellan.1 dst: /usr/share/man/man1/ dockers: - image_templates: - &amd64_linux_image git.towk2.me/towk/{{.ProjectName}}:{{ .Tag }}-amd64 - git.towk2.me/towk/{{.ProjectName}}:{{ .Major }}-amd64 - git.towk2.me/towk/{{.ProjectName}}:{{ .Major }}.{{ .Minor }}-amd64 use: buildx build_flag_templates: - "--pull" - "--platform=linux/amd64" - "--label=org.opencontainers.image.created={{.Date}}" - "--label=org.opencontainers.image.title={{.ProjectName}}" - "--label=org.opencontainers.image.revision={{.FullCommit}}" - "--label=org.opencontainers.image.version={{.Version}}" goarch: amd64 goamd64: v3 extra_files: - LICENSE - CHANGELOG.md - README.md - image_templates: - &arm64v7_linux_image git.towk2.me/towk/{{.ProjectName}}:{{ .Tag }}-arm64 - git.towk2.me/towk/{{.ProjectName}}:{{ .Major }}-arm64 - git.towk2.me/towk/{{.ProjectName}}:{{ .Major }}.{{ .Minor }}-arm64 use: buildx build_flag_templates: - "--pull" - "--platform=linux/arm64" - "--label=org.opencontainers.image.created={{.Date}}" - "--label=org.opencontainers.image.title={{.ProjectName}}" - "--label=org.opencontainers.image.revision={{.FullCommit}}" - "--label=org.opencontainers.image.version={{.Version}}" extra_files: - LICENSE - CHANGELOG.md - README.md goarch: arm64 docker_manifests: - name_template: "git.towk2.me/towk/{{.ProjectName}}:latest" image_templates: - *amd64_linux_image - *arm64v7_linux_image - name_template: "git.towk2.me/towk/{{.ProjectName}}:{{ .Tag }}" image_templates: - *amd64_linux_image - *arm64v7_linux_image - name_template: "git.towk2.me/towk/{{.ProjectName}}:{{ .Major }}" image_templates: - *amd64_linux_image - *arm64v7_linux_image - name_template: "git.towk2.me/towk/{{.ProjectName}}:{{ .Major }}.{{ .Minor }}" image_templates: - *amd64_linux_image - *arm64v7_linux_image checksum: name_template: 'checksums.txt' snapshot: version_template: "{{ incpatch .Version }}-next" changelog: sort: asc filters: exclude: - '^docs:' - '^test:'