magellan/.goreleaser.yaml
Alex Lovell-Troy 3682bbdcc7
chore: update build workflow and add container build script (#70)
* chore: update build workflow and add container build script
* Add build dependencies to workflow
* fix: remove unnecessary magellan installation path from goreleaser config
2025-04-26 16:58:58 -06:00

144 lines
4.5 KiB
YAML

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 <allend@lanl.gov>"
description: "Magellan is a discovery tool for BMCs."
homepage: "https://www.openchami.org"
license: MIT
section: utils
priority: optional
contents:
- src: magellan.1
dst: /usr/share/man/man1/
dockers:
- image_templates:
- &amd64_linux_image ghcr.io/davidallendj/{{.ProjectName}}:{{ .Tag }}-amd64
- ghcr.io/davidallendj/{{.ProjectName}}:{{ .Major }}-amd64
- ghcr.io/davidallendj/{{.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 ghcr.io/openchami/{{.ProjectName}}:{{ .Tag }}-arm64
- ghcr.io/openchami/{{.ProjectName}}:{{ .Major }}-arm64
- ghcr.io/openchami/{{.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: "ghcr.io/davidallendj/{{.ProjectName}}:latest"
image_templates:
- *amd64_linux_image
- *arm64v7_linux_image
- name_template: "ghcr.io/davidallendj/{{.ProjectName}}:{{ .Tag }}"
image_templates:
- *amd64_linux_image
- *arm64v7_linux_image
- name_template: "ghcr.io/davidallendj/{{.ProjectName}}:{{ .Major }}"
image_templates:
- *amd64_linux_image
- *arm64v7_linux_image
- name_template: "ghcr.io/davidallendj/{{.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:'