From 9e3f207f1939d9f52e8579892a8ac1f5d4cc70ff Mon Sep 17 00:00:00 2001 From: Aman Date: Sun, 10 Sep 2023 21:47:37 +0530 Subject: [PATCH] fix: add github token in `npm-publish.yml` --- .github/workflows/npm-publish.yml | 37 ++++++++++++++++++------------- package.json | 2 +- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 634df1c..4627717 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -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: @@ -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 }} diff --git a/package.json b/package.json index 7b39a45..5da3def 100644 --- a/package.json +++ b/package.json @@ -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",