From ad5b6143042f2b99c4c6a85dbe9176b36d9c8763 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 26 Oct 2020 02:24:39 +0800 Subject: [PATCH] Add new tool to bump version. --- tools/bump-version.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 tools/bump-version.sh diff --git a/tools/bump-version.sh b/tools/bump-version.sh new file mode 100755 index 0000000..e797f9b --- /dev/null +++ b/tools/bump-version.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# +# Bump latest version to file `_data/meta.yml` +# +# v2.5.1 +# https://github.com/cotes2020/jekyll-theme-chirpy +# © 2020 Cotes Chung +# Published under MIT License + +set -eu + +META_FILE="_data/meta.yml" + +_latest_tag="$(git describe --abbrev=0)" + +_version_field="version: $_latest_tag" + +if [[ ! -f $META_FILE ]]; then + echo "name: Chirpy" > $META_FILE + echo "$_version_field" >> $META_FILE +else + sed -i "s/^version:.*/$_version_field/g" $META_FILE +fi + +if [[ -n $(git status $META_FILE -s) ]]; then + git add $META_FILE + git commit -m "Bump version to $_latest_tag" +fi