@@ -58,6 +58,19 @@ if [ ! -f "main.cpp" ]; then
5858 exit 1
5959fi
6060
61+ # Detect if we're on GitButler workspace branch
62+ CURRENT_BRANCH=$( git branch --show-current)
63+ USING_GITBUTLER=false
64+
65+ if [ " $CURRENT_BRANCH " = " gitbutler/workspace" ]; then
66+ USING_GITBUTLER=true
67+ echo " 🔀 Detected GitButler workspace branch"
68+ echo " Switching to main branch for release..."
69+ git checkout main
70+ echo " ✅ Switched to main branch"
71+ echo " "
72+ fi
73+
6174# Get current version from source
6275CURRENT_VERSION=$( grep ' #define PCAP_SERVICE_VERSION ' main.cpp | awk -F ' "' ' {print $2}' )
6376echo " Current version in source: $CURRENT_VERSION "
7689 echo " ✅ Updated PCAP_SERVICE_VERSION to $VERSION "
7790fi
7891
92+ # Update version in Makefile
93+ MAKEFILE_VERSION=$( grep ' ^VERSION=' Makefile | cut -d' =' -f2)
94+ echo " Current version in Makefile: $MAKEFILE_VERSION "
95+
96+ if [ " $MAKEFILE_VERSION " = " $VERSION " ] && [ -z " $FORCE_FLAG " ]; then
97+ echo " ⚠️ Version is already set to $VERSION in Makefile"
98+ elif [ " $MAKEFILE_VERSION " = " $VERSION " ] && [ -n " $FORCE_FLAG " ]; then
99+ echo " ⚠️ Version is already set to $VERSION in Makefile (--force specified, continuing)"
100+ else
101+ echo " 📝 Updating version in Makefile..."
102+ sed -i.bak " s/^VERSION=.*/VERSION=$VERSION /" Makefile
103+ rm Makefile.bak
104+ echo " ✅ Updated Makefile VERSION to $VERSION "
105+ fi
106+
79107# Check if there are uncommitted changes
80- if ! git diff --quiet main.cpp; then
108+ if ! git diff --quiet main.cpp Makefile ; then
81109 echo " 📦 Committing version update..."
82- git add main.cpp
110+ git add main.cpp Makefile
83111 if [ -n " $FORCE_FLAG " ]; then
84112 # Force commit even if there might be conflicts
85113 git commit -m " bump version to $VERSION " || git commit --amend -m " bump version to $VERSION "
@@ -129,6 +157,14 @@ if [ "$PUSH_FLAG" = "--push" ]; then
129157 echo " "
130158 echo " ✅ Changes pushed! GitHub Actions will now build and release."
131159 echo " View progress at: https://github.com/whatpulse/linux-external-pcap-service/actions"
160+
161+ # Switch back to GitButler if we started there
162+ if [ " $USING_GITBUTLER " = true ]; then
163+ echo " "
164+ echo " 🔀 Switching back to GitButler workspace..."
165+ git checkout gitbutler/workspace
166+ echo " ✅ Returned to gitbutler/workspace branch"
167+ fi
132168else
133169 echo " Next steps:"
134170 echo " 1. Review the changes: git log --oneline -n 2"
@@ -152,6 +188,13 @@ else
152188 echo " "
153189 echo " ⚠️ Force mode enabled - this will overwrite existing releases!"
154190 fi
191+
192+ # Remind about GitButler if applicable
193+ if [ " $USING_GITBUTLER " = true ]; then
194+ echo " "
195+ echo " ⚠️ Currently on main branch (switched from gitbutler/workspace)"
196+ echo " After pushing, run: git checkout gitbutler/workspace"
197+ fi
155198fi
156199
157200echo " "
0 commit comments