Add GoReleaser configuration and version command
Some checks failed
goreleaser / goreleaser (push) Failing after 5m46s

This commit is contained in:
2025-05-23 15:41:54 +02:00
parent e1f7604439
commit a806b97b9b
5 changed files with 437 additions and 3 deletions

106
.goreleaser.yml Normal file
View File

@@ -0,0 +1,106 @@
# This is a GoReleaser configuration file
# For more information about configuration options, visit:
# https://goreleaser.com/customization/
version: 2
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
goos:
- linux
- darwin
goarch:
- amd64
- arm64
flags:
- -trimpath
ldflags:
- -s -w
- -X git.mvl.sh/vleeuwenmenno/sshtunnel/cmd.Version={{.Version}}
- -X git.mvl.sh/vleeuwenmenno/sshtunnel/cmd.BuildDate={{.Date}}
mod_timestamp: "{{ .CommitTimestamp }}"
archives:
- format: tar.gz
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 }}
format_overrides:
- goos: windows
format: zip
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
# Homebrew formula
brews:
- repository:
owner: vleeuwenmenno
name: homebrew-tap
token: "{{ .Env.GITHUB_TOKEN }}"
directory: Formula
homepage: "https://git.mvl.sh/vleeuwenmenno/sshtunnel"
description: "SSH tunnel manager CLI tool"
license: "MIT"
commit_author:
name: goreleaserbot
email: goreleaser@carlosbecker.com
install: |
bin.install "sshtunnel"
# Generate shell completions
output = Utils.safe_popen_read("#{bin}/sshtunnel", "completion", "bash")
(bash_completion/"sshtunnel").write output
output = Utils.safe_popen_read("#{bin}/sshtunnel", "completion", "zsh")
(zsh_completion/"_sshtunnel").write output
output = Utils.safe_popen_read("#{bin}/sshtunnel", "completion", "fish")
(fish_completion/"sshtunnel.fish").write output
test: |
system "#{bin}/sshtunnel", "version"
# .deb and .rpm packages
nfpms:
- file_name_template: "{{ .ProjectName }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
id: packages
homepage: https://git.mvl.sh/vleeuwenmenno/sshtunnel
description: |-
SSH tunnel manager CLI tool
maintainer: Menno van Leeuwen
license: MIT
vendor: vleeuwenmenno
formats:
- deb
- rpm
dependencies:
- openssh-client
recommends:
- bash-completion
scripts:
postinstall: |
sshtunnel completion bash > /usr/share/bash-completion/completions/sshtunnel
sshtunnel completion zsh > /usr/share/zsh/site-functions/_sshtunnel
sshtunnel completion fish > /usr/share/fish/vendor_completions.d/sshtunnel.fish
chmod 644 /usr/share/bash-completion/completions/sshtunnel || true
chmod 644 /usr/share/zsh/site-functions/_sshtunnel || true
chmod 644 /usr/share/fish/vendor_completions.d/sshtunnel.fish || true