fix: change registry #60
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 Pages | |
| # 触发条件,push到main分支或者pull request到main分支 | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| # 支持手动在工作流上触发 | |
| workflow_dispatch: | |
| # 设置时区 | |
| env: | |
| TZ: Asia/Shanghai | |
| # 添加节点版本环境变量方便引用 | |
| NODE_VERSION: 20 | |
| PNPM_VERSION: latest | |
| # 权限设置 | |
| permissions: | |
| # 允许读取仓库内容的权限。 | |
| contents: read | |
| # 允许写入 GitHub Pages 的权限。 | |
| pages: write | |
| # 允许写入 id-token 的权限。 | |
| id-token: write | |
| # 并发控制配置 | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true # 取消正在进行的运行,节省资源 | |
| # 定义执行任务 | |
| jobs: | |
| # 构建任务 | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 拉取代码 | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| # 保留 Git 信息 | |
| fetch-depth: 0 | |
| # 设置使用 Node.js 版本 | |
| - name: Setup Node.js ${{ env.NODE_VERSION }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| # 使用 最新的 PNPM | |
| # 你也可以指定为具体的版本 | |
| - name: Setup PNPM | |
| uses: pnpm/action-setup@v2 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| run_install: false | |
| # 添加PNPM缓存以加速构建 | |
| - name: Get PNPM store directory | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| - name: Setup PNPM cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| # 安装依赖 | |
| - name: Install Dependencies | |
| run: pnpm install --frozen-lockfile | |
| # 构建项目 | |
| - name: Build Project | |
| run: pnpm run build | |
| # 资源拷贝 | |
| - name: Prepare Static Files | |
| uses: actions/jekyll-build-pages@v1 | |
| with: | |
| source: ./apps/docs/.vitepress/dist | |
| destination: ./_site | |
| # 上传 _site 的资源,用于后续部署 | |
| - name: Upload Pages Artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| # 部署任务 | |
| deploy: | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |