feat: add more template #13
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: Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write # https://github.com/semantic-release/npm/blob/master/README.md#npm-provenance-on-github-actions | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # 重要:必须获取完整的 Git 历史 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "latest" # 需要20+ | |
| registry-url: "https://registry.npmjs.org/" | |
| - name: Set up pnpm | |
| uses: pnpm/action-setup@v2 # 使用官方的 pnpm action | |
| with: | |
| version: 8 | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Run Semantic Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 无需手动设置,GitHub 会自动注入 | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # 使用Automation类型的Token | |
| run: npx semantic-release |