Skip to content

Commit

Permalink
fix: add github token in npm-publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
aman162000 committed Sep 10, 2023
1 parent 2b09f59 commit 9e3f207
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
37 changes: 22 additions & 15 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Node.js Package
name: Node.js CI

on:
push:
Expand All @@ -10,27 +7,37 @@ on:
branches: "*"

jobs:
build:
runs-on: ubuntu-latest
quality:
runs-on: ${{ matrix.os }}

strategy:
matrix:
node-version: [16.x, 18.x]
os: [ubuntu-latest, windows-latest]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 18
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci

publish-npm:
needs: build
publish:
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/master' }}
needs: [quality]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm run semantic-release
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
GITHUB_TOKEN: ${{secrets.G_TOKEN}}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"semantic-release": "semantic-release",
"semantic-release": "semantic-release --branches master",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"assemble": "node scripts/assemble.mjs",
Expand Down

0 comments on commit 9e3f207

Please sign in to comment.