Only publish if we are in the original repo

This avoids people having failing actions in forks of our repo since
they don't have permission to publish things.
This commit is contained in:
Pierre Ossman 2021-11-09 16:21:41 +01:00
parent bbbcab692a
commit c2980d15e9
1 changed files with 6 additions and 0 deletions

View File

@ -31,18 +31,21 @@ jobs:
env: env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: | if: |
github.repository == 'novnc/noVNC' &&
github.event_name == 'release' && github.event_name == 'release' &&
!github.event.release.prerelease !github.event.release.prerelease
- run: npm publish --access public --tag beta - run: npm publish --access public --tag beta
env: env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: | if: |
github.repository == 'novnc/noVNC' &&
github.event_name == 'release' && github.event_name == 'release' &&
github.event.release.prerelease github.event.release.prerelease
- run: npm publish --access public --tag dev - run: npm publish --access public --tag dev
env: env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
if: | if: |
github.repository == 'novnc/noVNC' &&
github.event_name == 'push' && github.event_name == 'push' &&
github.event.ref == 'refs/heads/master' github.event.ref == 'refs/heads/master'
snap: snap:
@ -72,6 +75,7 @@ jobs:
snap: ${{ steps.snapcraft.outputs.snap }} snap: ${{ steps.snapcraft.outputs.snap }}
release: stable release: stable
if: | if: |
github.repository == 'novnc/noVNC' &&
github.event_name == 'release' && github.event_name == 'release' &&
!github.event.release.prerelease !github.event.release.prerelease
- uses: snapcore/action-publish@v1 - uses: snapcore/action-publish@v1
@ -80,6 +84,7 @@ jobs:
snap: ${{ steps.snapcraft.outputs.snap }} snap: ${{ steps.snapcraft.outputs.snap }}
release: beta release: beta
if: | if: |
github.repository == 'novnc/noVNC' &&
github.event_name == 'release' && github.event_name == 'release' &&
github.event.release.prerelease github.event.release.prerelease
- uses: snapcore/action-publish@v1 - uses: snapcore/action-publish@v1
@ -88,5 +93,6 @@ jobs:
snap: ${{ steps.snapcraft.outputs.snap }} snap: ${{ steps.snapcraft.outputs.snap }}
release: edge release: edge
if: | if: |
github.repository == 'novnc/noVNC' &&
github.event_name == 'push' && github.event_name == 'push' &&
github.event.ref == 'refs/heads/master' github.event.ref == 'refs/heads/master'