更新数据并部署 #1635
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: 更新数据并部署 | |
| on: | |
| schedule: | |
| - cron: '0 */3 * * *' | |
| push: | |
| branches: [main, dev] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| update-data: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - uses: pnpm/action-setup@v3 | |
| with: | |
| version: 8.4.0 | |
| - run: pnpm install --frozen-lockfile | |
| - run: node scripts/update-feeds.js | |
| env: | |
| LLM_API_KEY: ${{ secrets.LLM_API_KEY }} | |
| LLM_API_BASE: ${{ secrets.LLM_API_BASE }} | |
| LLM_NAME: ${{ secrets.LLM_NAME }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: data-artifact | |
| path: ./data | |
| deploy-github-pages: | |
| needs: update-data | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - uses: pnpm/action-setup@v3 | |
| with: | |
| version: 8.4.0 | |
| - run: pnpm install --frozen-lockfile | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: data-artifact | |
| path: ./data | |
| - name: Get repository name | |
| run: echo "REPOSITORY_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2)" >> $GITHUB_ENV | |
| - run: pnpm build | |
| env: | |
| REPOSITORY_NAME: ${{ env.REPOSITORY_NAME }} | |
| - uses: actions/configure-pages@v4 | |
| - uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./out | |
| - id: deployment | |
| uses: actions/deploy-pages@v4 | |
| deploy-vercel: | |
| needs: update-data | |
| runs-on: ubuntu-latest | |
| if: ${{ vars.ENABLE_VERCEL_DEPLOYMENT == 'true' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: data-artifact | |
| path: ./data | |
| - uses: amondnet/vercel-action@v25.2.0 | |
| with: | |
| vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
| vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | |
| vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} | |
| working-directory: ./ | |
| vercel-args: '--prod --build-env VERCEL=1' |