Skip to content

Commit 9500f70

Browse files
authored
chore(release): automate version bumping in release workflow (#289)
* chore(release): automate version bumping in release workflow - Bump package.json version to 0.2.0 to match latest release - Add automated version-bump step in release.yml workflow - Step updates package.json on main after successful release - Prevents version drift between released artifacts and repo - Uses [skip ci] to avoid recursive workflow triggers Signed-off-by: Aseem Shrey <LuD1161@users.noreply.github.com> * fix(release): skip main version bump when releasing non-latest tags - Add conditional check to only update package.json when is_latest=true - Prevents older backport/patch releases from overwriting main's version - Example: releasing v0.1.3 after v0.2.1 won't downgrade main to 0.1.3 - Update release summary to reflect conditional behavior Addresses feedback from @changex-codex-connector 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 b8f14a4 commit 9500f70

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,41 @@ jobs:
262262
echo " This might be expected if GitHub release fetching is enabled"
263263
fi
264264
265+
- name: Bump package.json version on main
266+
if: steps.is_latest.outputs.is_latest == 'true'
267+
run: |
268+
VERSION_CLEAN="${{ steps.version.outputs.version_clean }}"
269+
echo "Bumping root package.json version to ${VERSION_CLEAN}..."
270+
271+
git config user.name "github-actions[bot]"
272+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
273+
274+
git fetch origin main
275+
git checkout main
276+
277+
# Update the root package.json version
278+
jq --arg v "$VERSION_CLEAN" '.version = $v' package.json > package.json.tmp && mv package.json.tmp package.json
279+
280+
# Only commit if there's actually a change
281+
if git diff --quiet package.json; then
282+
echo "package.json already at version ${VERSION_CLEAN}, skipping commit."
283+
else
284+
git add package.json
285+
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"
288+
fi
289+
265290
- name: Release summary
266291
run: |
267292
echo "📋 Release Summary:"
268293
echo " ✅ Docker images built and pushed"
269294
echo " ✅ GitHub Release created: ${{ steps.version.outputs.version }}"
270295
echo " ✅ Version check service updated"
296+
if [ "${{ steps.is_latest.outputs.is_latest }}" = "true" ]; then
297+
echo " ✅ package.json version synced on main"
298+
else
299+
echo " ⏭️ package.json NOT updated (not the latest version)"
300+
fi
271301
echo ""
272302
echo "🎉 Users will now receive update notifications for version ${{ steps.version.outputs.version_clean }}"

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.1.2",
4+
"version": "0.2.0",
55
"packageManager": "bun@1.1.20",
66
"workspaces": [
77
"frontend",

0 commit comments

Comments
 (0)