Skip to content

Commit f686253

Browse files
committed
Handle my Gitbutler branch workflow when releasing new versions & bump remaining files to 1.3.0
1 parent 95bcbfc commit f686253

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ CFLAGS=-std=c++17 -Wall -Wextra -O2 -pthread
33
LDFLAGS=-lpcap -pthread
44
TARGET=whatpulse-pcap-service
55
SOURCES=main.cpp captureservice.cpp networkclient.cpp tcpclient.cpp pcapcapturethread.cpp pfringcapturethread.cpp logger.cpp
6-
VERSION=1.0.2
6+
VERSION=1.3.0
77

88
# Default target
99
all: $(TARGET)

main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#include "networkclient.h"
2727
#include "logger.h"
2828

29-
#define PCAP_SERVICE_VERSION "1.2.0"
29+
#define PCAP_SERVICE_VERSION "1.3.0"
3030

3131
// Global service instances for signal handler
3232
std::unique_ptr<CaptureService> g_captureService = nullptr;

release.sh

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,19 @@ if [ ! -f "main.cpp" ]; then
5858
exit 1
5959
fi
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
6275
CURRENT_VERSION=$(grep '#define PCAP_SERVICE_VERSION ' main.cpp | awk -F '"' '{print $2}')
6376
echo "Current version in source: $CURRENT_VERSION"
@@ -76,10 +89,25 @@ else
7689
echo "✅ Updated PCAP_SERVICE_VERSION to $VERSION"
7790
fi
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
132168
else
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
155198
fi
156199

157200
echo ""

0 commit comments

Comments
 (0)