-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add pre and post commit hooks for bumpver
- Loading branch information
1 parent
b33d3f8
commit 808584a
Showing
3 changed files
with
60 additions
and
1 deletion.
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,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
update_changelog() { | ||
local repo_url | ||
repo_url=$(git remote get-url origin | tr -d '\n' | sed 's/\.git$//') | ||
|
||
sed -i "0,/## \[Unreleased\]/s/## \[Unreleased\]/## [$BUMPVER_NEW_VERSION]/" CHANGELOG.md | ||
sed -i "/## \[$BUMPVER_NEW_VERSION\]/i ## [Unreleased]\n" CHANGELOG.md | ||
echo "[$BUMPVER_NEW_VERSION]: $repo_url/releases/tag/v$BUMPVER_NEW_VERSION" >>CHANGELOG.md | ||
sed -i "s|\[unreleased\]: .*|[unreleased]: $repo_url/compare/v$BUMPVER_NEW_VERSION...HEAD|" CHANGELOG.md | ||
|
||
git add CHANGELOG.md | ||
git commit -m "update CHANGELOG for version $BUMPVER_NEW_VERSION" | ||
} | ||
|
||
update_uvlock() { | ||
uv lock | ||
|
||
if ! git status --porcelain | grep -q "uv.lock"; then | ||
echo "No changes to uv.lock, skipping commit" | ||
return 0 | ||
fi | ||
|
||
git add uv.lock | ||
git commit -m "update uv.lock for version $BUMPVER_NEW_VERSION" | ||
} | ||
|
||
main() { | ||
update_changelog | ||
update_uvlock | ||
} | ||
|
||
main "$@" |
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,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
create_release_branch() { | ||
local release_branch="release-v${BUMPVER_NEW_VERSION}" | ||
|
||
if git show-ref --quiet "refs/heads/$release_branch" || | ||
git show-ref --quiet "refs/remotes/origin/$release_branch"; then | ||
echo "Error: Branch $release_branch already exists locally or remotely" >&2 | ||
exit 1 | ||
fi | ||
|
||
git checkout -b "$release_branch" | ||
echo "Created and switched to branch: $release_branch" | ||
} | ||
|
||
main() { | ||
create_release_branch | ||
} | ||
|
||
main "$@" |
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