Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release script #13

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ Below are links to the different packages:
[happtiq_commons_gen_ai](https://github.com/happtiq/happtiq-oss-python-libs/tree/main/packages/happtiq_commons_gen_ai)

[happtiq_commons_google_cloud](https://github.com/happtiq/happtiq-oss-python-libs/tree/main/packages/happtiq_commons_google_cloud)

## Release

run script `./release.sh`
38 changes: 38 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/bash

# Function to prompt for confirmation with Y as the default
confirm() {
read -p "$1 (Y/n): " choice
choice=${choice:-y} # Default to 'y' if no input is provided
case "$choice" in
y|Y ) return 0;;
* ) echo "Aborted."; exit 1;;
esac
}

# Function to validate semantic versioning
validate_version() {
if [[ ! $1 =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Version must follow semantic versioning (e.g., v1.0.0)."
exit 1
fi
}

# Ask for the version number
read -p "Enter the version number for the release (e.g., v1.0.0): " version

# Validate the version input
validate_version "$version"

# Confirm the version input
confirm "You entered version $version. Do you want to proceed?"

# Create a Git tag
confirm "Create the Git tag $version?"
git tag -a "$version" -m "Release $version"

# Push the Git tag to the repository
confirm "Push the tag $version to the remote repository?"
git push origin "$version"

echo "Release $version has been tagged and pushed successfully."
Loading