ci: fix ci #12
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 | |
| permissions: | |
| id-token: write | |
| contents: write | |
| pull-requests: write | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: true | |
| version: 10.28.2 | |
| - name: Build | |
| run: pnpm build | |
| - name: Configure npm authentication for pnpm (OIDC) | |
| run: | | |
| # setup-node 已经创建了 ~/.npmrc,pnpm 需要能够读取它 | |
| # 确保 @arkts scope 使用正确的 registry | |
| if [ -f ~/.npmrc ]; then | |
| echo "@arkts:registry=https://registry.npmjs.org/" >> ~/.npmrc | |
| fi | |
| echo "Verifying npm authentication..." | |
| npm whoami --registry=https://registry.npmjs.org/ || echo "Warning: npm whoami failed" | |
| - name: Create Release Pull Request or Publish to npm | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| createGithubReleases: true | |
| publish: pnpm changeset publish | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |