fix: change contributors to array to satisfy GitHub Packages #3
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: Publish to GitHub Packages | |
| on: | |
| # 允许手动触发 (方便测试) | |
| workflow_dispatch: | |
| # 每次推送到 main 分支时自动触发 (确保构建正常, 可选) | |
| push: | |
| branches: | |
| - "main" | |
| tags: | |
| - "v*" | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "18" | |
| registry-url: "https://npm.pkg.github.com" | |
| scope: "@PancrePal-xiaoyibao" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build project | |
| run: npm run build | |
| # 只有当 tag 触发,或者手动触发且 confirm 时才发布 | |
| - name: Publish to GitHub Packages | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |