Skip to content

Commit

Permalink
Update npm-publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
zkz098 authored May 20, 2023
1 parent 790e95e commit 20df6ee
Showing 1 changed file with 23 additions and 16 deletions.
39 changes: 23 additions & 16 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,39 @@ on:
release:
types: [created]

env:
NPM_TOKEN: ${{ secrets.npm_token }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
publish:
if: "!github.event.release.prerelease"
runs-on: ubuntu-latest

strategy:
matrix:
registry:
- name: NPM Registry
url: https://registry.npmjs.org/
token: ${{ env.NPM_TOKEN }}
- name: GitHub Packages Registry
url: https://npm.pkg.github.com/
token: ${{ env.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: ${{ matrix.registry.url }}
registry-url: https://registry.npmjs.org/

- name: Install dependencies
run: npm install pnpm -g

- name: Build TypeScript files
run: pnpm run build

- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}

publish-gh:
if: "!github.event.release.prerelease"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
registry-url: https://npm.pkg.github.com

- name: Install dependencies
run: npm install pnpm -g

Expand All @@ -38,4 +45,4 @@ jobs:

- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ matrix.registry.token }}
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 20df6ee

Please sign in to comment.