diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index f5c8658..2775a09 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,2 +1,3 @@ FROM mcr.microsoft.com/devcontainers/go:1.3.0-1.23-bookworm -RUN apt-get update && apt-get upgrade -y \ No newline at end of file +RUN echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list +RUN apt-get update && apt-get upgrade -y && apt-get install -y goreleaser \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6b20143..1ddea4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store .tool-versions -cmd/ocfl/ocfl \ No newline at end of file +cmd/ocfl/ocfl +dist/ diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..fdcd0c0 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,51 @@ +# This is an example .goreleaser.yml file with some sensible defaults. +# Make sure to check the documentation at https://goreleaser.com + +# The lines below are called `modelines`. See `:help modeline` +# Feel free to remove those if you don't want/need to use them. +# yaml-language-server: $schema=https://goreleaser.com/static/schema.json +# vim: set ts=2 sw=2 tw=0 fo=cnqoj + +version: 2 + +before: + hooks: + # You may remove this if you don't use go modules. + - go mod tidy + +builds: + - binary: ocfl + main: ./cmd/ocfl + env: + - CGO_ENABLED=0 + targets: + - linux_amd64_v1 + - linux_arm64 + - windows_amd64_v1 + - darwin_arm64 + + ldflags: + - -X github.com/srerickson/ocfl-tools/cmd/ocfl/run.Version={{.Version}} + - -X github.com/srerickson/ocfl-tools/cmd/ocfl/run.BuildTime={{.Date}} + +archives: + - format: 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 }} + # use zip for windows archives + format_overrides: + - goos: windows + format: zip + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" diff --git a/cmd/ocfl/run/run.go b/cmd/ocfl/run/run.go index 092548e..28e0816 100644 --- a/cmd/ocfl/run/run.go +++ b/cmd/ocfl/run/run.go @@ -257,11 +257,11 @@ func codeRev() string { } func printVersion(stdout io.Writer) { - fmt.Fprintf(stdout, "ocfl %s, built: %s", Version, BuildTime) + fmt.Fprintln(stdout, "ocfl: v"+Version) + fmt.Fprintln(stdout, "date:", BuildTime) if rev := codeRev(); rev != "" { - fmt.Fprintf(stdout, ", commit: [%s]", rev[:8]) + fmt.Fprintln(stdout, "commit:", rev[:8]) } - fmt.Fprintln(stdout) } func newLogger(l log.Level, w io.Writer) *slog.Logger {