mirror of
https://github.com/elisiariocouto/leggen.git
synced 2025-12-13 16:02:16 +00:00
chore: Initial version.
This commit is contained in:
44
scripts/release.sh
Executable file
44
scripts/release.sh
Executable file
@@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ef -o pipefail
|
||||
|
||||
function check_command {
|
||||
if ! command -v "$1" &> /dev/null; then
|
||||
echo "$1 not found. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_command git
|
||||
check_command git-cliff
|
||||
check_command poetry
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo " > No semver verb specified, run release with <major|minor|patch> parameter."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CURRENT_VERSION=$(poetry version -s)
|
||||
echo " > Current version is $CURRENT_VERSION"
|
||||
|
||||
poetry version "$1"
|
||||
NEXT_VERSION=$(poetry version -s)
|
||||
|
||||
echo " > leggen bumped to $NEXT_VERSION"
|
||||
echo "Updating CHANGELOG.md"
|
||||
git-cliff --unreleased --tag "$NEXT_VERSION" --prepend CHANGELOG.md > /dev/null
|
||||
|
||||
echo " > Commiting changes and adding git tag"
|
||||
git add pyproject.toml CHANGELOG.md
|
||||
git commit -m "chore(ci): Bump version to $NEXT_VERSION"
|
||||
git tag -a "$NEXT_VERSION" -m "$NEXT_VERSION"
|
||||
|
||||
read -p " > Are you sure you want to push the changes and tags to the remote repository? (y/n) " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo " > Pushing changes and tags to the remote repository"
|
||||
git push
|
||||
git push --tags
|
||||
else
|
||||
echo " > Changes and tags were not pushed to the remote repository"
|
||||
fi
|
||||
Reference in New Issue
Block a user