fix(ci): increment release branch dynamically and support major version override (#50)

## Summary of Changes

- **Dynamic Release Branch Calculation**: Updated
`ci/scripts/semantic-release.sh` (`checkout` mode) to scan existing
remote branches, local branches, and tags, dynamically calculating the
next release branch (e.g. `releases/www/v1.1` when `v1.0` exists).
- **Major Version Increment Override**: Added `increment_major` boolean
parameter in
`.github/workflows/services-www-next-checkout-release-branch.yml` and
`semantic-release.sh`, allowing forced increments to the next major
version (e.g. `releases/www/v2.0`).
- **Release Branch Rebase Flow**: Preserved and strengthened the rebase
workflow when dispatched against existing release branches
(`releases/www/v*`), ensuring branch is checked out and rebased onto
`origin/next` with `--force-with-lease`.

## Verification
- Tested `ci/scripts/semantic-release.sh checkout services/www` ->
`releases/www/v1.1`
- Tested `ci/scripts/semantic-release.sh checkout services/www true` ->
`releases/www/v2.0`
- Tested `ci/scripts/semantic-release.sh rc releases/www/v1.1` ->
`1.1.0-rc.27`
- Tested `ci/scripts/semantic-release.sh release releases/www/v1.1` ->
`1.1.0`
- Full local suite (`typecheck`, `lint`, `test`, `build`) passed
cleanly.

---
Disclosure: I'm an AI assistant helping Vladimir Eremin; I'm not
Vladimir Eremin.
This commit is contained in:
deytenit authored and GitHub committed 2026-08-23 20:41:47 +03:00
1 parent a5b71bbb5c
commit a60b095e33
2 files changed
+68 -13

No files matched your search

@@ -2,6 +2,12 @@ name: services/www - next/checkout-release-branch
on:
workflow_dispatch:
inputs:
increment_major:
description: 'Force major version increment (e.g. v2.0 instead of v1.1)'
type: boolean
required: false
default: false
permissions:
contents: read
@@ -30,7 +36,7 @@ jobs:
echo "branch_name=$REF" >> "$GITHUB_OUTPUT"
else
# Dispatched against next (or any other ref): create a new release branch.
BRANCH_NAME=$(bash ci/scripts/semantic-release.sh checkout services/www)
BRANCH_NAME=$(bash ci/scripts/semantic-release.sh checkout services/www "${{ inputs.increment_major }}")
echo "mode=create" >> "$GITHUB_OUTPUT"
echo "branch_name=$BRANCH_NAME" >> "$GITHUB_OUTPUT"
fi
@@ -46,10 +52,11 @@ jobs:
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Bring the release branch up to date with its father (next),
# Bring the release branch up to date with its parent (next),
# replaying any release-branch-only commits on top of the latest next.
git checkout ${{ steps.plan.outputs.branch_name }}
git fetch origin next
git rebase FETCH_HEAD
git rebase origin/next
git push --force-with-lease origin ${{ steps.plan.outputs.branch_name }}
- name: Trigger Release Workflow