Skip to content

Commit c783fef

Browse files
committed
chore: ensure pre-releases can't be run from the main branch
1 parent 3e2b9ca commit c783fef

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

.changeset/README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Choose the appropriate version bump type:
6060

6161
```typescript
6262
// Adding a new method
63-
call.setMaxVideoBitrate(1000); ← New feature, backwards compatible
63+
call.setMaxVideoBitrate(1000); // ← New feature, backwards compatible
6464
```
6565

6666
### Patch (Bug Fixes)
@@ -218,13 +218,17 @@ The release workflow runs automatically on every push to `main`:
218218

219219
**Workflow:** `.github/workflows/release.yml` (manual trigger)
220220

221+
**Important:** Pre-releases can only be published from non-main branches (feature or release branches).
222+
221223
To publish pre-releases:
222224

223-
1. Go to **Actions****Release**
224-
2. Click **Run workflow**
225-
3. Select release type: `prerelease`
226-
4. Select pre-release tag: `rc` (default), `beta`, or `alpha`
227-
5. Click **Run workflow**
225+
1. Switch to a feature or release branch (not `main`)
226+
2. Go to **Actions****Release**
227+
3. Click **Run workflow**
228+
4. Select the current branch
229+
5. Select release type: `prerelease`
230+
6. Select pre-release tag: `rc` (default), `beta`, or `alpha`
231+
7. Click **Run workflow**
228232

229233
The workflow will:
230234

.github/workflows/release.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,17 @@ jobs:
6161
echo "type=${{ github.event.inputs.release_type }}" >> $GITHUB_OUTPUT
6262
fi
6363
64+
- name: Validate Pre-release Branch
65+
if: steps.release_type.outputs.type == 'prerelease'
66+
run: |
67+
BRANCH="${{ github.ref_name }}"
68+
if [ "$BRANCH" = "main" ]; then
69+
echo "❌ Pre-releases cannot be published from the main branch"
70+
echo "💡 Please run pre-releases from a feature or release branch"
71+
exit 1
72+
fi
73+
echo "✅ Running pre-release from branch: $BRANCH"
74+
6475
- name: Exit Pre-release Mode (stable releases only)
6576
if: steps.release_type.outputs.type == 'stable'
6677
run: |

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ All PRs that change published packages **must include a changeset**. CI will fai
112112

113113
**Stable releases:** The **Release** workflow runs automatically on every push to `main` and creates/updates a "Version Packages" PR. It automatically exits pre-release mode if needed. Review and merge the PR to publish.
114114

115-
**Pre-releases:** Manually trigger the **Release** workflow, select `prerelease` type and choose tag: `rc` (default), `beta`, or `alpha`. First run publishes `rc.0`, subsequent runs publish `rc.1`, `rc.2`, etc.
115+
**Pre-releases:** From a non-main branch, manually trigger the **Release** workflow, select `prerelease` type and choose tag: `rc` (default), `beta`, or `alpha`. First run publishes `rc.0`, subsequent runs publish `rc.1`, `rc.2`, etc. Note: Pre-releases are restricted to non-main branches only.
116116

117117
See [.changeset/README.md](./.changeset/README.md) for detailed workflow documentation.
118118

0 commit comments

Comments
 (0)