Skip to content
Snippets Groups Projects
Unverified Commit b6c567ad authored by Timo Furrer's avatar Timo Furrer
Browse files

Outsource README generation script from Makefile into script

Changelog: development
parent 10286172
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env bash
set -o errexit
set -o errtrace
script_dir=$(dirname "$0")
csplit -sf readme -n 1 "${script_dir}/../README.md.template" '/<RENDER>/'
# shellcheck disable=SC2016
{
echo '<!-- This document is generated by `make docs` from `.gitlab/README.md` -->'
echo
cat readme0
echo
echo '### Available OpenTofu Versions'
echo
echo 'The following OpenTofu versions are available with this component via the `opentofu_version` input:'
echo
yq '.".data".supported_versions | .[] | "- [`" + . + "`](https://github.com/opentofu/opentofu/releases/tag/v" + . + ")"' "${script_dir}/../../opentofu_versions.yaml"
tail -n+2 readme1
} > "${script_dir}/../../README.md"
rm -f readme0 readme1 readme_inputs.md
RELEASE_SCRIPT = ./.gitlab/scripts/release.sh GENERATE_README_SCRIPT ?= ./.gitlab/scripts/generate-readme.sh
RELEASE_SCRIPT ?= ./.gitlab/scripts/release.sh
.PHONY: all .PHONY: all
all: docs all: docs
.PHONY: docs .PHONY: docs
docs: docs:
csplit -sf readme -n 1 .gitlab/README.md.template '/<RENDER>/' $(GENERATE_README_SCRIPT)
echo '<!-- This document is generated by `make docs` from `.gitlab/README.md` -->' > README.md
echo >> README.md
cat readme0 >> README.md
echo >> README.md
echo '### Available OpenTofu Versions' >> README.md
echo >> README.md
echo 'The following OpenTofu versions are available with this component via the `opentofu_version` input:' >> README.md
echo >> README.md
yq '.".data".supported_versions | .[] | "- [`" + . + "`](https://github.com/opentofu/opentofu/releases/tag/v" + . + ")"' opentofu_versions.yaml >> README.md
tail -n+2 readme1 >> README.md
rm -f readme0 readme1 readme_inputs.md
.PHONY: release .PHONY: release
release: release:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment