Use make for license generation and checks

This commit is contained in:
Andy Feller 2025-06-20 16:53:11 -04:00
parent 4d1eb59c36
commit 11e8a8127d
4 changed files with 12 additions and 10 deletions

View file

@ -58,4 +58,4 @@ jobs:
run: |
export GOROOT=$(go env GOROOT)
export PATH=${GOROOT}/bin:$PATH
./script/licenses-check
make licenses-check

View file

@ -106,3 +106,11 @@ ifndef VERSION
endif
./script/release --local "$(VERSION)" --platform macos
./script/pkgmacos $(VERSION)
.PHONY: licenses
licenses:
./script/licenses
.PHONY: licenses-check
licenses-check:
./script/licenses-check

View file

@ -25,7 +25,7 @@ When dependencies change, you need to update the license information:
1. Update license information for all platforms:
```shell
script/licenses
make licenses
```
2. Commit the changes:
@ -40,13 +40,7 @@ When dependencies change, you need to update the license information:
The CI workflow checks if license information is up to date. To check locally:
```sh
script/licenses-check
make licenses-check
```
If the check fails, follow the instructions to update the license information.
## How It Works
- `script/licenses` - Script to generate license information for all platforms or a specific platform
- `script/licenses-check` - Script to check if license information is up to date
- `.github/workflows/lint.yml` - CI workflow that includes license compliance checking

View file

@ -15,7 +15,7 @@ for goos in linux darwin windows ; do
echo "Checking licenses for ${goos}..."
GOOS="${goos}" go-licenses report ./... --template .github/licenses.tmpl --ignore github.com/cli/cli > "${TEMPDIR}/third-party-licenses.${goos}.md" || echo "Ignore warnings"
if ! diff -s "${TEMPDIR}/third-party-licenses.${goos}.md" "third-party-licenses.${goos}.md"; then
echo "::error title=License check failed::Please update the license files by running \`script/licenses\` and committing the output."
echo "::error title=License check failed::Please update the license files by running \`make licenses\` and committing the output."
exit 1
fi
done