1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-04 03:11:55 +02:00
goreleaser/scripts/cmd_docs.sh
Patrick Hahn e5a9e18050
feat(schema): add command that generates jsonschema (#2589)
* feat(schema): Add command that generates the jsonschema for .goreleaser.yml files

This commit adds the jsonschema/schema subcommand that generates a jsonschema doc based on the Project go struct.
For the config types that alternatively allow you to specify a string via custom UnmarshalYAML function, this commit adds the JSONSchemaType function, so the type gets documented with an oneOf with string or itself.
Add yaml key names for properties that are currently missing them, so alecthomas/jsonschema generates the keys with correct casing.

Signed-off-by: Patrick Hahn <patricksilashahn@gmx.net>

* fix: Add linguist-generated attribute to generated schema json to exclude this file from pull request size validation

Signed-off-by: Patrick Hahn <patricksilashahn@gmx.net>

* fix: run gofumpt

Signed-off-by: Patrick Hahn <patricksilashahn@gmx.net>

* chore(schema): update alecthomas/jsonschema and regenerate schema.json

Signed-off-by: Patrick Hahn <patricksilashahn@gmx.net>
2021-10-26 15:02:03 -03:00

20 lines
328 B
Bash
Executable File

#!/bin/sh
set -e
SED="sed"
if which gsed >/dev/null 2>&1; then
SED="gsed"
fi
rm -rf www/docs/cmd/*.md
go run . docs
go run . schema -o ./www/docs/static/schema.json
"$SED" \
-i'' \
-e 's/SEE ALSO/See also/g' \
-e 's/^## /# /g' \
-e 's/^### /## /g' \
-e 's/^#### /### /g' \
-e 's/^##### /#### /g' \
./www/docs/cmd/*.md