Skip to content

Commit 3ad7ea4

Browse files
ci: finalize semantic release setup (#22)
1 parent 5919aad commit 3ad7ea4

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

.github/workflows/release.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,14 @@ jobs:
1818
- ubuntu-latest
1919

2020
steps:
21+
- name: Check branch name # make sure the release can only be run on branches like 'release-*'
22+
run: |
23+
ref="${{ github.ref }}"
24+
if [[ ! "$ref" =~ ^refs/heads/release-* ]]; then
25+
echo "Error: Workflow can only run on branches starting with 'release-*'"
26+
exit 1
27+
fi
2128
- uses: actions/checkout@v4
22-
2329
- name: Use Node.js ${{ matrix.node-version }}
2430
uses: actions/setup-node@v4
2531
with:
@@ -36,8 +42,8 @@ jobs:
3642
needs: lint-build-test # previous job MUST pass to make a release!
3743
runs-on: ubuntu-latest
3844

39-
# Skip running release workflow on forks
40-
if: github.repository_owner == 'salesforce' && github.event_name == 'push'
45+
# This workflow can only be triggered manually in the source (non forked) repository.
46+
if: github.repository_owner == 'salesforce' && github.event_name == 'workflow_dispatch'
4147

4248
permissions:
4349
contents: write # to be able to publish a GitHub release
@@ -66,4 +72,4 @@ jobs:
6672
run: npx semantic-release
6773
env:
6874
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
75+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)