feat(widget): 准备 npm 包发布

- 添加 GitHub Actions 工作流以在推送标签时自动发布到 npm
- 更新 package.json,包含包名、版本、描述、作者等信息
- 添加 README.md、LICENSE 和 .npmignore 文件
- 更新根目录 .gitignore,忽略 .npmrc 文件
This commit is contained in:
anghunk
2026-01-31 11:48:15 +08:00
parent 1a7a9db88f
commit 59acfec575
6 changed files with 297 additions and 4 deletions

37
.github/workflows/npm_publish.yml vendored Normal file
View 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