@@ -42,15 +42,15 @@ check_project_root() {
4242# Validate version format (semantic versioning)
4343validate_version () {
4444 local version=" $1 "
45-
45+
4646 # Remove 'v' prefix if present
4747 version=" ${version# v} "
48-
48+
4949 # Check semantic version format (X.Y.Z with optional pre-release suffix)
5050 if [[ ! " $version " =~ ^[0-9]+\. [0-9]+\. [0-9]+ (-[a-zA-Z0-9]+ (\. [a-zA-Z0-9]+)* )? $ ]]; then
5151 log_error " Invalid version format: $version . Expected format: 1.2.3 or 1.2.3-rc1"
5252 fi
53-
53+
5454 echo " $version "
5555}
5656
@@ -66,7 +66,7 @@ check_git_clean() {
6666check_main_branch () {
6767 local current_branch
6868 current_branch=" $( git rev-parse --abbrev-ref HEAD) "
69-
69+
7070 if [[ " $current_branch " != " main" && " $current_branch " != " master" ]]; then
7171 log_warning " Not on main/master branch (currently on: $current_branch )"
7272 read -p " Continue anyway? [y/N]: " -n 1 -r
@@ -81,21 +81,21 @@ check_main_branch() {
8181# Run pre-release checks
8282run_pre_release_checks () {
8383 log_info " Running pre-release checks..."
84-
84+
8585 # Run tests
8686 log_info " Running tests..."
8787 if ! make test > /dev/null 2>&1 ; then
8888 log_error " Tests failed. Please fix before releasing."
8989 fi
9090 log_success " Tests passed"
91-
91+
9292 # Run linting
9393 log_info " Running linting..."
9494 if ! make lint > /dev/null 2>&1 ; then
9595 log_error " Linting failed. Please fix before releasing."
9696 fi
9797 log_success " Linting passed"
98-
98+
9999 # Check for security vulnerabilities
100100 log_info " Running security scan..."
101101 if ! go install golang.org/x/vuln/cmd/govulncheck@latest > /dev/null 2>&1 ; then
@@ -105,7 +105,7 @@ run_pre_release_checks() {
105105 else
106106 log_success " Security scan passed"
107107 fi
108-
108+
109109 # Verify dependencies
110110 log_info " Verifying dependencies..."
111111 if ! go mod verify > /dev/null 2>&1 ; then
@@ -125,23 +125,23 @@ update_version_file() {
125125create_git_tag () {
126126 local version=" $1 "
127127 local tag=" v$version "
128-
128+
129129 # Check if tag already exists
130130 if git rev-parse " $tag " > /dev/null 2>&1 ; then
131131 log_error " Tag $tag already exists"
132132 fi
133-
133+
134134 # Stage VERSION file
135135 git add VERSION
136-
136+
137137 # Commit version update
138- git commit -m " Release $tag "
138+ git commit -m " release: $tag "
139139 log_success " Committed version update"
140-
140+
141141 # Create annotated tag
142142 git tag -a " $tag " -m " Release $tag "
143143 log_success " Created tag $tag "
144-
144+
145145 # Push to origin
146146 log_info " Pushing to origin..."
147147 git push origin HEAD
@@ -185,7 +185,7 @@ main() {
185185 local version=" "
186186 local dry_run=false
187187 local skip_checks=false
188-
188+
189189 # Parse arguments
190190 while [[ $# -gt 0 ]]; do
191191 case $1 in
@@ -214,49 +214,49 @@ main() {
214214 ;;
215215 esac
216216 done
217-
217+
218218 # Check if version was provided
219219 if [[ -z " $version " ]]; then
220220 log_error " Version argument is required. Use --help for usage information."
221221 fi
222-
222+
223223 # Validate and normalise version
224224 version=" $( validate_version " $version " ) "
225225 log_info " Preparing release for version: $version "
226-
226+
227227 # Check project setup
228228 check_project_root
229-
229+
230230 # Git checks
231231 check_git_clean
232232 check_main_branch
233-
233+
234234 # Pre-release checks
235235 if [[ " $skip_checks " == false ]]; then
236236 run_pre_release_checks
237237 else
238238 log_warning " Skipping pre-release checks as requested"
239239 fi
240-
240+
241241 # Update VERSION file
242242 update_version_file " $version "
243-
243+
244244 if [[ " $dry_run " == true ]]; then
245245 log_warning " Dry run mode - not creating git tag"
246246 log_info " Would create tag: v$version "
247-
247+
248248 # Restore original VERSION file
249249 git checkout -- VERSION
250250 log_info " Restored original VERSION file"
251251 else
252252 # Create and push tag
253253 create_git_tag " $version "
254-
254+
255255 log_success " Release v$version completed!"
256256 log_info " GitHub Actions will now build and publish the release."
257257 log_info " Monitor the release at: https://github.com/orien/stackaroo/actions"
258258 fi
259259}
260260
261261# Run main function with all arguments
262- main " $@ "
262+ main " $@ "
0 commit comments