chore: 🚀 优化发布npm的workflow

This commit is contained in:
xuqingkai 2023-08-18 19:00:25 +08:00
parent 868abd0c56
commit 9cd9b0c1e1

View File

@ -1,36 +1,29 @@
# 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: publish to npm
name: Publish to npm
on:
push:
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
- name: Install Dependencies
- run: yarn
- run: yarn compiler
jobs:
publish:
needs: install
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: https://npm.pkg.github.com/
- run: yarn publish
registry-url: https://registry.npmjs.org
- name: Install Dependencies
run: yarn
- name: Run Compiler
run: yarn compiler
- name: Publish Package
run: yarn publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}