From 1988968b335e7622c0551299797be1b53c295c66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=87=A4=E5=AE=9D=28Leo=29?= Date: Tue, 4 Feb 2025 18:33:21 +0800 Subject: [PATCH] chore: update npm-publish.yml --- .github/workflows/npm-publish.yml | 39 ++++++++++++++++++++++++------- package.json | 2 +- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index f0ad0a0..69732d5 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,7 +1,7 @@ # 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: Publish to npm on: release: @@ -11,23 +11,44 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 with: node-version: 20 - - run: npm ci - - run: npm test + + - name: Install pnpm + run: npm install -g pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + # Uncomment the following line if you want to run tests + # - name: Run tests + # run: pnpm test publish-npm: needs: build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 with: node-version: 20 registry-url: https://registry.npmjs.org/ - - run: npm ci - - run: npm publish + + - name: Install pnpm + run: npm install -g pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Publish to npm + run: npm publish --access=public env: NODE_AUTH_TOKEN: ${{secrets.tiny_codes_token}} diff --git a/package.json b/package.json index 64e6db6..e563256 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "bin": { - "swagger-api-hub": "./bin/swagger-api-hub.js" + "swagger-api-hub": "bin/swagger-api-hub.js" }, "files": [ "bin",