Build Browser Extension #7
This file contains hidden or 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
| name: Build Browser Extension | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - master | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. 检出代码 | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # 2. 安装 pnpm | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 # 根据你项目使用的 pnpm 版本调整 | |
| # 3. 配置 Node.js 并启用 pnpm 缓存 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' # 根据项目需要选择 Node 版本 | |
| cache: 'pnpm' | |
| # 4. 安装依赖 | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| # 5. 构建 Chrome (zip) 与 Firefox (zip:firefox) 两个版本 | |
| - name: Build extension packages | |
| run: | | |
| pnpm zip | |
| pnpm zip:firefox | |
| # 6. 上传 ZIP 产物(请根据实际输出目录调整路径) | |
| # 常见的 WXT 输出位置是 .output/,也可能在 dist/ 下 | |
| - name: Upload ZIP artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: extension-packages | |
| path: .output/*.zip |