add goreleaser configuration for binaries and deb/rpm packages

- build static binaries for linux, darwin and freebsd
- create deb and rpm packages that register gosh in /etc/shells
- publish releases to Gitea
- add --version flag, set at build time via ldflags

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Florian WaltherandClaude Opus 5.5 committed 2026-10-03 16:58:50 +02:00
1 parent d5c3d03a21
commit 37d6802815
6 files changed
+152

No files matched your search

+103
View File
@@ -0,0 +1,103 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# Release: git tag -a v0.1.0 -m "v0.1.0" && git push origin v0.1.0 && goreleaser release --clean
# Local test (no publishing): goreleaser release --snapshot --clean
version: 2
project_name: gosh
# GITHUB_TOKEN/GITLAB_TOKEN may also be set; always use Gitea.
force_token: gitea
before:
hooks:
- go mod tidy
- go test ./...
builds:
- id: gosh
binary: gosh
main: .
env:
- CGO_ENABLED=0
flags:
- -trimpath
ldflags:
- -s -w -X main.version={{ .Version }}
goos:
- linux
- darwin
- freebsd
goarch:
- amd64
- arm64
- arm
- "386"
goarm:
- "7"
ignore:
- goos: darwin
goarch: "386"
- goos: darwin
goarch: arm
mod_timestamp: "{{ .CommitTimestamp }}"
archives:
- id: gosh
formats: [tar.gz]
name_template: >-
{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}
files:
- src: README.md
info:
mode: 0644
nfpms:
- id: gosh
package_name: gosh
file_name_template: "{{ .ConventionalFileName }}"
ids: [gosh]
formats:
- deb
- rpm
vendor: Florian Walther
maintainer: Florian Walther <florian.walther@certainity.com>
homepage: https://gitea.scu.si/Florian.Walther/gosh
description: |-
gosh - a simple shell written in Go
Proof of concept with history, tab completion,
tilde and environment variable expansion.
license: ""
section: shells
priority: optional
bindir: /usr/bin
contents:
- src: README.md
dst: /usr/share/doc/gosh/README.md
file_info:
mode: 0644
scripts:
postinstall: packaging/scripts/postinstall.sh
postremove: packaging/scripts/postremove.sh
checksum:
name_template: checksums.txt
snapshot:
version_template: "{{ incpatch .Version }}-next"
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
# Repository is hosted on Gitea; requires GITEA_TOKEN in the environment.
gitea_urls:
api: https://gitea.scu.si/api/v1
download: https://gitea.scu.si
release:
gitea:
owner: Florian.Walther
name: gosh