演示和发布包拆开 #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple workflow for deploying static content to GitHub Pages | |
name: Deploy example to Pages | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
tags: | |
- "v*" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- run: npm i | |
- name: 编译 package | |
run: npm run build | |
- name: 发布到npmjs | |
env: | |
NPM_TPKEN: ${{ secrets.NPM_TOKEN }} | |
if: ${{ env.NPM_TPKEN != '' }} | |
run: | | |
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }} | |
npm publish |