generated from rochacbruno/python-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixing the release script * Adding the automatic next version detection
- Loading branch information
Showing
3 changed files
with
63 additions
and
10 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
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,34 @@ | ||
#!/bin/bash | ||
|
||
# Get the list of tags and sort them in version order | ||
LATEST_TAG=$(git tag -l | sort -V | tail -n1) | ||
|
||
# Split the tag into major, minor, and patch versions | ||
IFS='.' read -ra ADDR <<< "$LATEST_TAG" | ||
MAJOR=${ADDR[0]} | ||
MINOR=${ADDR[1]} | ||
PATCH=${ADDR[2]} | ||
|
||
# Decide which part to increment based on the passed argument | ||
case "$1" in | ||
--major) | ||
MAJOR=$((MAJOR+1)) | ||
MINOR=0 | ||
PATCH=0 | ||
;; | ||
--minor) | ||
MINOR=$((MINOR+1)) | ||
PATCH=0 | ||
;; | ||
--patch) | ||
PATCH=$((PATCH+1)) | ||
;; | ||
*) | ||
# By default increment minor version | ||
MINOR=$((MINOR+1)) | ||
PATCH=0 | ||
;; | ||
esac | ||
|
||
# Print the next version | ||
echo "$MAJOR.$MINOR.$PATCH" |
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,28 @@ | ||
#!/bin/bash | ||
|
||
# Display warning | ||
echo "WARNING: This operation will create a version tag and push to GitHub" | ||
|
||
# Get the next version | ||
TAG=$(./next_version.sh "$@") | ||
|
||
# Display the version | ||
echo "Releasing version '${TAG}'" | ||
|
||
# Write the version to a file | ||
echo "${TAG}" > brds/VERSION | ||
|
||
# Generate changelog and commit the changes (assuming ENV_PREFIX is set in your environment) | ||
${ENV_PREFIX}gitchangelog > HISTORY.md | ||
|
||
# Add files and commit | ||
git add brds/VERSION HISTORY.md | ||
git commit -m "release: version ${TAG} 🚀" | ||
|
||
# Create git tag and push | ||
echo "creating git tag : ${TAG}" | ||
git tag ${TAG} | ||
git push -u origin HEAD --tags | ||
|
||
# Notification | ||
echo "Github Actions will detect the new tag and release the new version." |