Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
added an npm publish job
  • Loading branch information
saadshams committed Sep 13, 2024
1 parent 5e3ed18 commit e1c4b1b
Showing 1 changed file with 30 additions and 15 deletions.
45 changes: 30 additions & 15 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ jobs:
strategy:
matrix:
node-version: [19.x, 20.x, 21.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
Expand All @@ -30,17 +29,33 @@ jobs:
- run: xvfb-run --auto-servernum npm run test:chrome
- run: xvfb-run --auto-servernum npm run test:firefox

- name: Publish to npm dry-run
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
npm publish --dry-run
- name: Publish to npm
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
npm publish
# Separate job for publishing to npm
publish:
runs-on: ubuntu-latest
needs: build # Wait for build to complete
if: github.ref == 'refs/heads/master' && github.event_name == 'push'

steps:
- uses: actions/checkout@v3
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: "20.x"
cache: "npm"
- run: npm install
- run: npm run build

- name: Publish to npm dry-run
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
npm publish --dry-run
- name: Publish to npm
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
npm publish

0 comments on commit e1c4b1b

Please sign in to comment.