Skip to content

Commit f23cb89

Browse files
authored
dont allow non-snapshot manual release (#1060)
1 parent e89830a commit f23cb89

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

.github/workflows/release.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# This workflow handles two flows:
22
#
33
# 1. Normal release (default)
4-
# Triggered by pushes to `main`. Uses changesets/action to either open a
5-
# "Version Packages" PR or, when such a PR is merged, publish to npm.
4+
# Triggered only by pushes to `main` (not by manual workflow runs).
5+
# Uses changesets/action to either open a "Version Packages" PR or, when such
6+
# a PR is merged, publish to npm.
67
#
78
# 2. Snapshot release (manual, opt-in)
89
# Triggered by running this workflow via workflow_dispatch with the
@@ -54,7 +55,7 @@ on:
5455
workflow_dispatch:
5556
inputs:
5657
snapshot:
57-
description: "Publish a snapshot release from the selected branch (under the `snapshot` dist-tag) instead of running the normal release flow. Requires a changeset on the branch."
58+
description: "Manual runs must enable this to publish (snapshot dist-tag from the selected branch); otherwise the workflow fails. Stable versioning/publish runs only on push to main. Requires a changeset on the branch."
5859
type: boolean
5960
default: false
6061

@@ -85,9 +86,15 @@ jobs:
8586
- name: Install Dependencies
8687
run: pnpm install
8788

88-
# ----- Normal release (push to main, or manual run without snapshot) -----
89+
- name: Disallow manual non-snapshot release
90+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.snapshot != true }}
91+
run: |
92+
echo "::error::Stable releases (changesets version/publish) run only on push to main. For a manual run, enable the snapshot input."
93+
exit 1
94+
95+
# ----- Normal release (push to main only) -----
8996
- name: Create Release Pull Request or Publish to npm
90-
if: ${{ inputs.snapshot != true }}
97+
if: ${{ github.event_name == 'push' }}
9198
id: changesets
9299
uses: changesets/action@v1
93100
with:

0 commit comments

Comments
 (0)