Skip to content

Commit 2954efb

Browse files
committed
various: Add release workflow components
1 parent b772b70 commit 2954efb

File tree

7 files changed

+190
-0
lines changed

7 files changed

+190
-0
lines changed

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
- name: Set up Go
17+
uses: actions/setup-go@v2
18+
with:
19+
go-version: 1.19
20+
- name: Run GoReleaser
21+
uses: goreleaser/goreleaser-action@v2
22+
with:
23+
version: latest
24+
args: release --rm-dist
25+
env:
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
docker:
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Set up QEMU
31+
uses: docker/setup-qemu-action@v1
32+
- name: Set up Docker Buildx
33+
uses: docker/setup-buildx-action@v1
34+
- name: Login to GCHR
35+
uses: docker/login-action@v1
36+
with:
37+
registry: ghcr.io
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
- name: Set version
41+
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
42+
- name: Build and push
43+
id: docker_build
44+
uses: docker/build-push-action@v2
45+
with:
46+
push: true
47+
tags: "ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION }}"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
NOTICE
2+
dist/
3+
vendor/

.goreleaser.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
before:
2+
hooks:
3+
- go mod vendor
4+
- scripts/prepare.sh
5+
builds:
6+
- goos:
7+
- darwin
8+
- freebsd
9+
- linux
10+
- windows
11+
archives:
12+
- replacements:
13+
darwin: Darwin
14+
linux: Linux
15+
windows: Windows
16+
386: i386
17+
amd64: x86_64
18+
files:
19+
- LICENSE
20+
- NOTICE
21+
- README.md
22+
checksum:
23+
name_template: 'checksums.txt'
24+
snapshot:
25+
name_template: "{{ .Tag }}-next"
26+
changelog:
27+
sort: asc
28+
filters:
29+
exclude:
30+
- '^docs:'
31+
- '^test:'
32+
release:
33+
github:
34+
owner: netauth
35+
name: netradius

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright 2023 Michael Aldridge
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# NetAuth RADIUS Server
2+
3+
The NetAuth RADIUS server acts as a RADIUS protocol bridge to allow
4+
basic authentication against the NetAuth entity authentication flow
5+
for services that understand the RADIUS protocol, sometimes referred
6+
to as 802.1X.
7+
8+
The RADIUS server is extremely simplistic and only supports the PAP
9+
profile, so use with care. For this reason you should try to install
10+
the server as close to your RADIUS clients as possible to avoid
11+
information being transmitted insecurely. There is no need to run a
12+
single netradius server for an entire site, an arbitrarily many
13+
servers may be deployed.
14+
15+
The NAS Secret implementation is very simplistic, expecting a single
16+
shared key for all clients. You may set this key via the
17+
`NETAUTH_RADIUS_SECRET` environment variable.
18+

scripts/prepare.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
./scripts/vendor-licenses > NOTICE

scripts/vendor-licenses

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
3+
list_vendor_files() {
4+
find vendor -type f -a \( -iname 'COPYING*' -o -iname 'LICENSE*' \) | sort
5+
}
6+
7+
list_files() {
8+
goroot="$(go env GOROOT)"
9+
goid='Go programming language'
10+
if [ -r "$goroot/LICENSE" ]; then
11+
echo "${goid}::$goroot/LICENSE"
12+
elif [ -r /usr/share/licenses/go/LICENSE ]; then
13+
echo "${goid}::/usr/share/licenses/go/LICENSE"
14+
else # last restort: HTTP
15+
echo "${goid}::https://golang.org/LICENSE?m=text"
16+
fi
17+
list_vendor_files
18+
}
19+
20+
generate_notice() {
21+
last=
22+
$0 -all | while IFS=$'\n' read -r license; do
23+
pkg="${license%%::*}"
24+
if [ "$pkg" != "$license" ]; then
25+
license="${license#${pkg}::}"
26+
else
27+
pkg="${pkg#vendor/}"
28+
pkg="${pkg%/*}"
29+
fi
30+
31+
printf "%s" "${last:+'\n\n\n'}"
32+
last=x
33+
34+
echo "$pkg" | sed 'p;s/./-/g'
35+
fetch "${license}"
36+
done
37+
}
38+
39+
fetch() {
40+
case "$1" in
41+
*://*) wget -q -O- "${1#*::}";;
42+
*) cat "${1#*::}";;
43+
esac
44+
}
45+
46+
case "${1--gen}" in
47+
-gen)
48+
if [ -t 1 ]; then
49+
generate_notice | ${PAGER:-more}
50+
else
51+
generate_notice
52+
fi
53+
;;
54+
-src) list_vendor_files;;
55+
-all) list_files;;
56+
-h)
57+
echo 'Usage: vendor-licenses [-h|-gen|-src|-all]' >&2
58+
exit 2
59+
;;
60+
*)
61+
echo "Unrecognized argument: '$1'" >&2
62+
exit 1
63+
;;
64+
esac

0 commit comments

Comments
 (0)