mirror of
https://github.com/netauth/ldap.git
synced 2024-11-24 12:31:55 -06:00
meta: Add release machinery
This commit is contained in:
parent
1ce7cfb147
commit
4a82eb8228
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
NOTICE
|
||||
dist/
|
||||
vendor/
|
40
.goreleaser.yml
Normal file
40
.goreleaser.yml
Normal file
|
@ -0,0 +1,40 @@
|
|||
# This is an example goreleaser.yaml file with some sane defaults.
|
||||
# Make sure to check the documentation at http://goreleaser.com
|
||||
before:
|
||||
hooks:
|
||||
- go mod vendor
|
||||
- ./scripts/vendor-licenses -gen > NOTICE
|
||||
builds:
|
||||
- id: ldap
|
||||
main: main.go
|
||||
binary: ldap
|
||||
goos:
|
||||
- darwin
|
||||
- freebsd
|
||||
- linux
|
||||
- windows
|
||||
archives:
|
||||
- replacements:
|
||||
darwin: Darwin
|
||||
linux: Linux
|
||||
windows: Windows
|
||||
386: i386
|
||||
amd64: x86_64
|
||||
files:
|
||||
- LICENSE
|
||||
- NOTICE
|
||||
- README.md
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}-next"
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- '^docs:'
|
||||
- '^test:'
|
||||
release:
|
||||
github:
|
||||
owner: NetAuth
|
||||
name: ldap
|
64
scripts/vendor-licenses
Executable file
64
scripts/vendor-licenses
Executable file
|
@ -0,0 +1,64 @@
|
|||
#!/bin/bash
|
||||
|
||||
list_vendor_files() {
|
||||
find vendor -type f -a \( -iname 'COPYING*' -o -iname 'LICENSE*' \) | sort
|
||||
}
|
||||
|
||||
list_files() {
|
||||
goroot="$(go env GOROOT)"
|
||||
goid='Go programming language'
|
||||
if [ -r "$goroot/LICENSE" ]; then
|
||||
echo "${goid}::$goroot/LICENSE"
|
||||
elif [ -r /usr/share/licenses/go/LICENSE ]; then
|
||||
echo "${goid}::/usr/share/licenses/go/LICENSE"
|
||||
else # last restort: HTTP
|
||||
echo "${goid}::https://golang.org/LICENSE?m=text"
|
||||
fi
|
||||
list_vendor_files
|
||||
}
|
||||
|
||||
generate_notice() {
|
||||
last=
|
||||
$0 -all | while IFS=$'\n' read license; do
|
||||
pkg="${license%%::*}"
|
||||
if [ "$pkg" != "$license" ]; then
|
||||
license="${license#${pkg}::}"
|
||||
else
|
||||
pkg="${pkg#vendor/}"
|
||||
pkg="${pkg%/*}"
|
||||
fi
|
||||
|
||||
printf ${last:+'\n\n\n'}
|
||||
last=x
|
||||
|
||||
echo "$pkg" | sed 'p;s/./-/g'
|
||||
fetch "${license}"
|
||||
done
|
||||
}
|
||||
|
||||
fetch() {
|
||||
case "$1" in
|
||||
*://*) wget -q -O- "${1#*::}";;
|
||||
*) cat "${1#*::}";;
|
||||
esac
|
||||
}
|
||||
|
||||
case "${1--gen}" in
|
||||
-gen)
|
||||
if [ -t 1 ]; then
|
||||
generate_notice | ${PAGER:-more}
|
||||
else
|
||||
generate_notice
|
||||
fi
|
||||
;;
|
||||
-src) list_vendor_files;;
|
||||
-all) list_files;;
|
||||
-h)
|
||||
echo 'Usage: vendor-licenses [-h|-gen|-src|-all]' >&2
|
||||
exit 2
|
||||
;;
|
||||
*)
|
||||
echo "Unrecognized argument: '$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
Loading…
Reference in a new issue