Skip to content

Commit d0b575f

Browse files
resolve beta release PR comments
1 parent 226b81a commit d0b575f

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ concurrency:
2020
group: release
2121
cancel-in-progress: true
2222

23+
defaults:
24+
run:
25+
shell: bash
26+
2327
jobs:
2428
get_version:
2529
runs-on: ubuntu-latest
@@ -45,6 +49,7 @@ jobs:
4549
PKG_NAME: ${{ github.event.inputs.package_name }}
4650
REPO: ${{ github.repository }}
4751
RELEASE_BRANCH: ${{ github.event.inputs.release_branch_name }}
52+
TRIGGER_BRANCH: ${{ github.ref_name }}
4853
NPM_DIST_TAG: ${{ github.event.inputs.npmjs_dist_tag }}
4954
run: |
5055
set -euo pipefail
@@ -100,6 +105,11 @@ jobs:
100105
exit 1
101106
fi
102107
108+
if [[ "$TRIGGER_BRANCH" != "main" ]]; then
109+
echo "❌ Release pipeline can only be triggered from the 'main' branch. Current branch: '$TRIGGER_BRANCH'." >&2
110+
exit 1
111+
fi
112+
103113
{
104114
echo "NPM_DIST_TAG=$NPM_DIST_TAG"
105115
echo "RELEASE_BRANCH=$RELEASE_BRANCH"
@@ -142,7 +152,6 @@ jobs:
142152
env:
143153
IS_BETA: ${{ steps.validate_inputs.outputs.is_beta }}
144154
PKG_NAME: ${{ github.event.inputs.package_name }}
145-
NPM_DIST_TAG: ${{ github.event.inputs.npmjs_dist_tag }}
146155
run: |
147156
set -euo pipefail
148157
PKG_JSON="packages/${PKG_NAME}/package.json"
@@ -156,12 +165,10 @@ jobs:
156165
exit 1
157166
fi
158167
159-
NPM_DIST_TAG="${NPM_DIST_TAG:-latest}"
160168
if [[ "${IS_BETA:-false}" != "true" ]] && ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
161169
echo "With npmjs_dist_tag 'latest', version must be of the form x.y.z. Found '$VERSION'." >&2
162170
exit 1
163171
fi
164-
echo "PACKAGE_VERSION=$VERSION" >> "$GITHUB_ENV"
165172
echo "package_version=$VERSION" >> "$GITHUB_OUTPUT"
166173
echo "dist_tag=${NPM_DIST_TAG}" >> "$GITHUB_OUTPUT"
167174

0 commit comments

Comments
 (0)