Skip to content

Commit cc68536

Browse files
committed
Add new tool to bump version.
1 parent 25dd38b commit cc68536

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

tools/bump-version.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Bump latest version to file `_data/meta.yml`
4+
#
5+
# v2.5.1
6+
# https://github.com/cotes2020/jekyll-theme-chirpy
7+
# © 2020 Cotes Chung
8+
# Published under MIT License
9+
10+
set -eu
11+
12+
META_FILE="_data/meta.yml"
13+
14+
_latest_tag="$(git describe --abbrev=0)"
15+
16+
_version_field="version: $_latest_tag"
17+
18+
if [[ ! -f $META_FILE ]]; then
19+
echo "name: Chirpy" > $META_FILE
20+
echo "$_version_field" >> $META_FILE
21+
else
22+
sed -i "s/^version:.*/$_version_field/g" $META_FILE
23+
fi
24+
25+
if [[ -n $(git status $META_FILE -s) ]]; then
26+
git add $META_FILE
27+
git commit -m "Bump version to $_latest_tag"
28+
fi

0 commit comments

Comments
 (0)