Skip to content

Commit 6b3e039

Browse files
authored
fix(release): bump version to 0.2.1 and fix workflow for protected branches (#290)
* chore: bump version to 0.2.1 Signed-off-by: Aseem Shrey <LuD1161@users.noreply.github.com> * fix(release): create PR for version bump instead of direct push The release workflow was failing to bump package.json because main is a protected branch that requires PRs. Changed the version bump step to create a PR with auto-merge enabled instead of pushing directly to main. Signed-off-by: Aseem Shrey <LuD1161@users.noreply.github.com> --------- Signed-off-by: Aseem Shrey <LuD1161@users.noreply.github.com> Co-authored-by: Aseem Shrey <LuD1161@users.noreply.github.com>
1 parent 9500f70 commit 6b3e039

2 files changed

Lines changed: 24 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -262,29 +262,45 @@ jobs:
262262
echo " This might be expected if GitHub release fetching is enabled"
263263
fi
264264
265-
- name: Bump package.json version on main
265+
- name: Bump package.json version via PR
266266
if: steps.is_latest.outputs.is_latest == 'true'
267+
env:
268+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
267269
run: |
268270
VERSION_CLEAN="${{ steps.version.outputs.version_clean }}"
271+
BRANCH="chore/bump-version-${VERSION_CLEAN}"
269272
echo "Bumping root package.json version to ${VERSION_CLEAN}..."
270273
271274
git config user.name "github-actions[bot]"
272275
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
273276
274277
git fetch origin main
275-
git checkout main
278+
git checkout -b "$BRANCH" origin/main
276279
277280
# Update the root package.json version
278281
jq --arg v "$VERSION_CLEAN" '.version = $v' package.json > package.json.tmp && mv package.json.tmp package.json
279282
280-
# Only commit if there's actually a change
283+
# Only create PR if there's actually a change
281284
if git diff --quiet package.json; then
282-
echo "package.json already at version ${VERSION_CLEAN}, skipping commit."
285+
echo "package.json already at version ${VERSION_CLEAN}, skipping."
283286
else
284287
git add package.json
285288
git commit -m "chore: bump version to ${VERSION_CLEAN} [skip ci]"
286-
git push origin main
287-
echo "✅ package.json version bumped to ${VERSION_CLEAN} on main"
289+
git push origin "$BRANCH"
290+
291+
# Create PR and enable auto-merge
292+
PR_URL=$(gh pr create \
293+
--title "chore: bump version to ${VERSION_CLEAN}" \
294+
--body "Automated version bump from release workflow (${VERSION_CLEAN})." \
295+
--base main \
296+
--head "$BRANCH")
297+
298+
echo "✅ Created PR: $PR_URL"
299+
300+
# Attempt to enable auto-merge (requires repo setting enabled)
301+
gh pr merge "$PR_URL" --auto --squash 2>/dev/null \
302+
&& echo "✅ Auto-merge enabled" \
303+
|| echo "⚠️ Auto-merge not available — merge the PR manually"
288304
fi
289305
290306
- name: Release summary
@@ -294,7 +310,7 @@ jobs:
294310
echo " ✅ GitHub Release created: ${{ steps.version.outputs.version }}"
295311
echo " ✅ Version check service updated"
296312
if [ "${{ steps.is_latest.outputs.is_latest }}" = "true" ]; then
297-
echo " ✅ package.json version synced on main"
313+
echo " ✅ package.json version bump PR created"
298314
else
299315
echo " ⏭️ package.json NOT updated (not the latest version)"
300316
fi

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "shipsec-studio",
33
"private": true,
4-
"version": "0.2.0",
4+
"version": "0.2.1",
55
"packageManager": "bun@1.1.20",
66
"workspaces": [
77
"frontend",

0 commit comments

Comments
 (0)