Skip to content

Commit 58601d0

Browse files
committed
fix: release script handles same-version and auto-detects remote name
1 parent ed770e3 commit 58601d0

1 file changed

Lines changed: 21 additions & 7 deletions

File tree

scripts/release.sh

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,27 @@ rm -f "$TAURI_CONF.bak"
144144

145145
echo -e "${GREEN}Updated versions in package.json and tauri.conf.json${NC}"
146146

147-
# ── Commit version bump ──
147+
# ── Detect remote name ──
148+
149+
REMOTE=$(git -C "$PROJECT_DIR" remote | head -1)
150+
if [ -z "$REMOTE" ]; then
151+
echo -e "${RED}Error: no git remote configured${NC}"
152+
exit 1
153+
fi
154+
BRANCH=$(git -C "$PROJECT_DIR" branch --show-current)
155+
echo "Remote: $REMOTE ($BRANCH)"
156+
157+
# ── Commit version bump (only if there are changes) ──
148158

149159
cd "$PROJECT_DIR"
150160
git add package.json src-tauri/tauri.conf.json
151-
git commit -m "chore: bump version to $VERSION"
152161

153-
echo -e "${GREEN}Committed version bump${NC}"
162+
if git diff --cached --quiet; then
163+
echo -e "${YELLOW}Version already at $VERSION, no commit needed${NC}"
164+
else
165+
git commit -m "chore: bump version to $VERSION"
166+
echo -e "${GREEN}Committed version bump${NC}"
167+
fi
154168

155169
# ── Create tag ──
156170

@@ -160,15 +174,15 @@ echo -e "${GREEN}Created tag v$VERSION${NC}"
160174
# ── Push ──
161175

162176
echo ""
163-
read -p "Push to origin? (y/N) " -n 1 -r
177+
read -p "Push to $REMOTE? (y/N) " -n 1 -r
164178
echo ""
165179
if [[ $REPLY =~ ^[Yy]$ ]]; then
166-
git push origin master --tags
167-
echo -e "${GREEN}Pushed to origin. GitHub Actions will build and create the release.${NC}"
180+
git push "$REMOTE" "$BRANCH" --tags
181+
echo -e "${GREEN}Pushed to $REMOTE. GitHub Actions will build and create the release.${NC}"
168182
else
169183
echo ""
170184
echo "To push manually:"
171-
echo " git push origin master --tags"
185+
echo " git push $REMOTE $BRANCH --tags"
172186
fi
173187

174188
echo ""

0 commit comments

Comments
 (0)