Skip to content

Commit

Permalink
Update the publishing workflow to publish to npm too
Browse files Browse the repository at this point in the history
  • Loading branch information
mahozad committed Mar 11, 2022
1 parent 87a30ac commit a7dd7e2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/publish-new-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ jobs:
needs: [ run-tests ]
name: Publish the artifacts to GitHub Packages
runs-on: ubuntu-latest
environment:
name: npm
url: https://www.npmjs.com/package/@mahozad/theme-switch
permissions:
contents: read
packages: write
Expand All @@ -77,6 +80,8 @@ jobs:
run: |
echo "{\"chromiumPath\": \"$(which chromium)\"}" > local.json
# See https://sevic.dev/npm-publish-github-actions/
# Could also have set it with the registry-url property of the setup-node action.
# See https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-npm
# The npm client is able to work with only one registry at a time:
# It is not possible to simultaneously use both npmjs.com and GitHub Packages registry.
- name: Set npm package registry to GitHub Packages
Expand All @@ -87,6 +92,19 @@ jobs:
# run: npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
- name: Publish the package to GitHub Packages registry
run: npm publish
- name: Resetup the node
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
- name: Install the package and its dependencies
run: npm install
- name: Set path to a chromium browser (needed for screenshot tests)
run: |
echo "{\"chromiumPath\": \"$(which chromium)\"}" > local.json
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

create-github-release:
needs: [ publish-the-package ]
Expand Down

0 comments on commit a7dd7e2

Please sign in to comment.