update workflow #22
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: read | ||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '18' # 你项目使用的 Node.js 版本 | ||
| registry-url: 'https://registry.npmjs.org/' | ||
| always-auth: true | ||
| - name: Install Yarn | ||
| run: npm install -g yarn | ||
| - name: Install | ||
| run: yarn | ||
| - name: Build project | ||
| run: yarn build # 假设你的项目有一个构建步骤 | ||
| - name: Debug OIDC Token (Trusted Publisher) | ||
| run: | | ||
| echo "OIDC 令牌是否存在: ${{ runner.oidc.token != '' }}" | ||
| - name: Publish | ||
| id: changesets | ||
| uses: changesets/action@v1 | ||
| with: | ||
| # Note: pnpm install after versioning is necessary to refresh lockfile | ||
| version: yarn version | ||
| publish: yarn release | ||
| commit: '[ci] release' | ||
| title: '[ci] release' | ||
| env: | ||
| # Needs access to push to main | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||