Files
mini-graph-card/scripts/update_readme.sh
Jérôme Wiedemann 0d22b3bf73 chore(ci): Auto-update README.md with versions
Only happens while releasing on master:
* `NEXT_VERSION` should be used in all the `README.md` `since` columns.
* Links and url will automatically be updated to the latest release
2022-01-22 20:50:23 +01:00

26 lines
720 B
Bash
Executable File

#!/bin/sh
set -e
VERSION=$1
BRANCH=$2
if [ -z "${VERSION}" ]; then
echo "Version not specified; Exiting."
exit 1;
fi
if [ -z "${BRANCH}" ]; then
echo "Version not specified; Exiting."
exit 1;
fi
if [ ! "${BRANCH}" = "refs/heads/master" ]; then
echo "Branch is ${BRANCH}; README.md not updated."
exit 0;
fi
sed -i -e "s/NEXT_VERSION/v${VERSION}/g" ./README.md
sed -i -e "s|https://github.com/kalkih/mini-graph-card/releases/download/.*/mini-graph-card-bundle.js|https://github.com/kalkih/mini-graph-card/releases/download/v${VERSION}/mini-graph-card-bundle.js|g" ./README.md
sed -i -e "s|-\surl:\s/local/mini-graph-card-bundle.js?v=.*|- url: /local/mini-graph-card-bundle.js?v=${VERSION}|g" ./README.md