Test: 是Action.yml的问题? #3
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: Deploy tldraw to GitHub Pages | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| # 1. 检出代码 | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # 2. 设置 Node.js 环境 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 # 升级到 v4 | |
| with: | |
| node-version: 20 | |
| cache: 'yarn' | |
| # 3. 启用 Corepack 并安装正确 Yarn 版本 | |
| - name: Setup Yarn via Corepack | |
| run: | | |
| # 启用 Corepack 并安装 package.json 指定的 Yarn 版本 | |
| corepack enable | |
| corepack prepare yarn@stable --activate | |
| # 验证 Yarn 版本 | |
| yarn --version | |
| shell: bash | |
| # 4. 安装依赖 | |
| - name: Install dependencies | |
| run: yarn install --immutable | |
| shell: bash | |
| # 5. 构建项目 | |
| - name: Build project | |
| run: yarn build | |
| shell: bash | |
| # 6. 部署到 GitHub Pages | |
| - name: Deploy to gh-pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: dist |