feat(widget): 准备 npm 包发布
- 添加 GitHub Actions 工作流以在推送标签时自动发布到 npm - 更新 package.json,包含包名、版本、描述、作者等信息 - 添加 README.md、LICENSE 和 .npmignore 文件 - 更新根目录 .gitignore,忽略 .npmrc 文件
This commit is contained in:
37
.github/workflows/npm_publish.yml
vendored
Normal file
37
.github/workflows/npm_publish.yml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: Publish widget to npm
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "widget-v*"
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: docs/widget
|
||||
run: npm ci
|
||||
|
||||
- name: Build widget
|
||||
working-directory: docs/widget
|
||||
run: npm run build
|
||||
|
||||
- name: Publish to npm
|
||||
working-directory: docs/widget
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: npm publish --access public
|
||||
Reference in New Issue
Block a user