Remove pnpm cache configuration from deploy workflow #2
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: Vercel Optimization Deployment | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: # 关键:任何人的 PR 都会触发,且不再需要手动授权 | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10.32.0 # 对应你 package.json 里的 pnpm 版本 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install Vercel CLI | |
| run: npm install --global vercel@latest | |
| - name: Pull Vercel Environment Information | |
| run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} | |
| - name: Build Project Artifacts | |
| run: vercel build --token=${{ secrets.VERCEL_TOKEN }} | |
| - name: Deploy Project Artifacts to Vercel | |
| run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} > deployment_url.txt | |
| # 可选:如果你想让机器人在 PR 下面自动留言预览链接 | |
| - name: Output Deployment URL | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| echo "预览地址已生成: $(cat deployment_url.txt)" |