Skip to content

Commit

Permalink
ci: finalize semantic release setup
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-zhang-at-salesforce committed Jun 24, 2024
1 parent 5919aad commit 08d375d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@ jobs:
- ubuntu-latest

steps:
- name: Check branch name # make sure the release can only be run on branches like 'release-*'
run: |
ref="${{ github.ref }}"
if [[ ! "$ref" =~ ^refs/heads/release-* ]]; then
echo "Error: Workflow can only run on branches starting with 'release-*'"
exit 1
fi
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
Expand All @@ -36,8 +42,8 @@ jobs:
needs: lint-build-test # previous job MUST pass to make a release!
runs-on: ubuntu-latest

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

permissions:
contents: write # to be able to publish a GitHub release
Expand Down Expand Up @@ -66,4 +72,4 @@ jobs:
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 08d375d

Please sign in to comment.