update #256
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 Package | |
| on: | |
| push: | |
| branches: | |
| - "master" | |
| tags: | |
| - "release-*" | |
| # 允许你从 Actions 选项卡手动运行此工作流程 | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_run: | |
| workflows: ["publish"] | |
| types: | |
| - completed | |
| permissions: | |
| contents: write # to create release (changesets/action) | |
| issues: write # to post issue comments (changesets/action) | |
| pull-requests: write # to create pull request (changesets/action) | |
| id-token: write # to use OpenID Connect token for provenance (changesets/action) | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| # 步骤顺序调整:setup-node 必须紧接在 checkout 之后 | |
| - name: Setup Node.js environment | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Create Release Pull Request or Publish to npm | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| publish: ${{ startsWith(github.ref_name, 'release-') && 'bun run only-publish-packages' || 'bun run publish-packages' }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| npm_config_registry: https://registry.npmjs.org | |
| NPM_CONFIG_PROVENANCE: true |