Deploy to GitHub Pages #99
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 to GitHub Pages | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| # Lite 页面上的下载按钮指向构建时查到的那一版安装包。Lite 发了新版之后, | |
| # 不重新构建的话按钮会一直指着旧版本 —— 旧版照样能装、装上会自己更新, | |
| # 但没理由让它停在那里。定时重建一次,最多晚三个小时跟上。 | |
| schedule: | |
| - cron: "41 */3 * * *" | |
| # Each job gets only what it needs (below). The build runs third-party code from | |
| # npm with GITHUB_TOKEN in its environment, so it may only read; the Pages | |
| # permissions belong to the deploy job alone. | |
| permissions: {} | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| # The sitemap's <lastmod> and the dates on doc pages come from git | |
| # history; a shallow clone would leave them out. | |
| fetch-depth: 0 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build site | |
| run: pnpm build | |
| env: | |
| # The build reads versions and releases from the GitHub API; with a | |
| # token the anonymous rate limit does not apply. | |
| GITHUB_TOKEN: ${{ github.token }} | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./dist | |
| deploy: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pages: write # to deploy to GitHub Pages | |
| id-token: write # to verify that the deployment comes from this workflow | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |