Skip to content

Commit

Permalink
ci(github-actions): prevent publishing on forks (#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
chimurai committed Apr 15, 2024
1 parent e6fa5ea commit 700a151
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
types: [prereleased, released]
jobs:
build-and-publish:
# prevents this action from running on forks
if: github.repository == 'chimurai/requirements'
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -14,13 +16,16 @@ jobs:
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'

- name: Install Dependencies
run: yarn install

- name: Publish to NPM (beta)
if: "github.event.release.prerelease"
run: npm publish --provenance --access public --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish to NPM (stable)
if: "!github.event.release.prerelease"
run: npm publish --provenance --access public
Expand Down

0 comments on commit 700a151

Please sign in to comment.