-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add version subcommand and bump command
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/sh | ||
set -e | ||
set -u | ||
|
||
my_version="${1-}" | ||
if [ -z "${my_version}" ]; then | ||
echo "Usage: bump.sh v1.2.3" | ||
exit 1 | ||
fi | ||
|
||
if ! git diff --quiet; then | ||
echo "Error: git status is dirty" | ||
fi | ||
|
||
if ! command -v sd > /dev/null; then | ||
echo "Install 'sd' first." | ||
echo " curl https://webi.sh/sd | sh" | ||
exit 1 | ||
fi | ||
|
||
my_commit_hash="$( | ||
git rev-parse --short HEAD | ||
)" | ||
my_commit_date="$( | ||
git show -s --format=%ci "${my_commit_hash}" | | ||
grep -E '20[0-9]{2}-[01][0-9]-[0123][0-9]' | ||
)" | ||
my_year="$( | ||
date '+%Y' | ||
)" | ||
|
||
sd 'my_version=.*' "my_version='${my_version}'" duckdns.sh | ||
sd 'my_year=.*' "my_year='${my_year}'" duckdns.sh | ||
sd 'my_date=.*' "my_date='${my_commit_date}'" duckdns.sh | ||
|
||
git add ./duckdns.sh | ||
git commit -m "chore(release): bump to ${my_version}" | ||
git tag "${my_version}" | ||
|
||
git describe --tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters