Man page release workflow wip

This commit is contained in:
Mike Farah
2021-10-20 15:01:08 +11:00
parent e5f389d0c2
commit ee376fdfd2
4 changed files with 88 additions and 61 deletions

19
scripts/generate-man-page-md.sh Executable file
View File

@@ -0,0 +1,19 @@
#! /bin/bash
set -e
# note that this reqires pandoc to be installed.
cat ./pkg/yqlib/doc/headers/Main.md > man.md
printf "\n# HOW IT WORKS\n" >> man.md
cat ./pkg/yqlib/doc/aa.md >> man.md
for f in ./pkg/yqlib/doc/*.md; do
docNameWithExt="${f##*/}"
docName="${docNameWithExt%.*}"
docNameCap=$(echo $docName | tr [a-z] [A-Z])
if [ "$docName" != "aa" ]; then
printf "\n\n# ${docNameCap}\n" >> man.md
cat "$f" >> man.md
fi
done

View File

@@ -3,26 +3,9 @@ set -e
# note that this reqires pandoc to be installed.
cat ./pkg/yqlib/doc/headers/Main.md > man.md
printf "\n# HOW IT WORKS\n" >> man.md
cat ./pkg/yqlib/doc/aa.md >> man.md
for f in ./pkg/yqlib/doc/*.md; do
docNameWithExt="${f##*/}"
docName="${docNameWithExt%.*}"
docNameCap=$(echo $docName | tr [a-z] [A-Z])
if [ "$docName" != "aa" ]; then
printf "\n\n# ${docNameCap}\n" >> man.md
cat "$f" >> man.md
fi
done
header=$(./yq --version)
pandoc \
--variable=title:"YQ" \
--variable=section:"1" \
--variable=author:"Mike Farah" \
--variable=header:"${header}" \
--standalone --to man man.md -o build/yq.1
--variable=header:"${MAN_HEADER}" \
--standalone --to man man.md -o yq.1

View File

@@ -6,8 +6,6 @@ set -e
CGO_ENABLED=0 gox -ldflags "${LDFLAGS}" -output="build/yq_{{.OS}}_{{.Arch}}" --osarch="darwin/amd64 darwin/arm64 freebsd/386 freebsd/amd64 freebsd/arm linux/386 linux/amd64 linux/arm linux/arm64 linux/mips linux/mips64 linux/mips64le linux/mipsle linux/ppc64 linux/ppc64le linux/s390x netbsd/386 netbsd/amd64 netbsd/arm openbsd/386 openbsd/amd64 windows/386 windows/amd64"
./scripts/generate-man-page.sh
cd build
find . -executable -type f | xargs -I {} tar czvf {}.tar.gz {} yq.1 -C ../scripts install-man-page.sh