diff --git a/pre-commit_semantic-release.sh b/pre-commit_semantic-release.sh index 9d34d74..4f4b24a 100755 --- a/pre-commit_semantic-release.sh +++ b/pre-commit_semantic-release.sh @@ -14,9 +14,9 @@ sed -i -e "s_^\(version:\).*_\1 ${1}_" FORMULA sudo -H pip install m2r # Copy and then convert the `.md` docs -cp *.md docs/ -cd docs/ -m2r --overwrite *.md +cp ./*.md docs/ +cd docs/ || exit +m2r --overwrite ./*.md # Change excess `H1` headings to `H2` in converted `CHANGELOG.rst` sed -i -e '/^=.*$/s/=/-/g' CHANGELOG.rst @@ -28,3 +28,15 @@ sed -i -e '1,4s/-/=/g' CHANGELOG.rst # Return back to the main directory cd .. + + +############################################################################### +# (C) Update last version before `v1.0.0` with `${nextRelease.version}` +############################################################################### +# Only apply this while the version number is below `v1.0.0`! +V_REPR=v${1} +MAJOR=$(echo "${V_REPR}" | cut -c-2) +if [ "${MAJOR}" = "v0" ]; then + sed -i -e "s@^\(\s\+\`\).*\(\s\`_\.\)@\1${V_REPR}\2${V_REPR}\3@" docs/README.rst + sed -i -e "s@^\(\s\+# the final release tag before \`v1.0.0\`, which is expected to be \`\).*\(\`.\s\+#\)@\1${V_REPR}\2@" fail2ban/deprecated.sls +fi diff --git a/release.config.js b/release.config.js index 6af7aa8..cb42175 100644 --- a/release.config.js +++ b/release.config.js @@ -14,7 +14,7 @@ module.exports = { prepareCmd: 'sh ./pre-commit_semantic-release.sh ${nextRelease.version}', }], ['@semantic-release/git', { - assets: ['*.md', 'docs/*.rst', 'FORMULA'], + assets: ['*.md', 'docs/*.rst', 'FORMULA', 'fail2ban/deprecated.sls'], }], '@semantic-release/github', ],