Repository navigation
post: 第三节精简为一段可直接复制的 prompt + 换封面为真实截图 #578
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: build | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'posts/**' | |
| - 'post/**' | |
| - 'data/posts.json' | |
| - 'data/cloudbase-backup/**' | |
| - 'assets/js/config.js' | |
| - 'assets/js/post.js' | |
| - 'assets/js/pageviews.js' | |
| - 'assets/js/cloudbase-pv.js' | |
| - 'post.html' | |
| - 'index.html' | |
| - 'scripts/build.mjs' | |
| - 'scripts/markdown-render.mjs' | |
| - 'scripts/prerender-post-html.mjs' | |
| - 'scripts/cloudbase-*.mjs' | |
| - 'package.json' | |
| - 'package-lock.json' | |
| - 'sw.js' | |
| - 'tools/**' | |
| - 'tool-*.html' | |
| - 'tools.html' | |
| - 'tool-kit.html' | |
| - 'tcb.html' | |
| - 'tcb-admin.html' | |
| - 'tcb-download.html' | |
| - 'tcb-feedback.html' | |
| - 'scripts/generate-tool-pages.mjs' | |
| - 'scripts/tool-page-shell.mjs' | |
| - 'scripts/backup-cloudbase-data.mjs' | |
| - '.github/workflows/build.yml' | |
| - '.github/workflows/backup-cloudbase.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| environment: github-pages | |
| concurrency: | |
| group: build-${{ github.ref }} | |
| cancel-in-progress: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Pull CloudBase backup (for build-time embed) | |
| env: | |
| COMMENT_ADMIN_SECRET: ${{ secrets.COMMENT_ADMIN_SECRET }} | |
| COMMENT_ADMIN_SECRET_VAR: ${{ vars.COMMENT_ADMIN_SECRET }} | |
| CLOUDBASE_HTTP_URL: ${{ secrets.CLOUDBASE_HTTP_URL }} | |
| TENCENTCLOUD_SECRETID: ${{ secrets.TENCENTCLOUD_SECRETID }} | |
| TENCENTCLOUD_SECRETKEY: ${{ secrets.TENCENTCLOUD_SECRETKEY }} | |
| CLOUDBASE_BUILD_FETCH: '1' | |
| run: node scripts/backup-cloudbase-data.mjs | |
| continue-on-error: true | |
| - name: Generate sitemap / rss / prerender posts | |
| env: | |
| COMMENT_ADMIN_SECRET: ${{ secrets.COMMENT_ADMIN_SECRET }} | |
| COMMENT_ADMIN_SECRET_VAR: ${{ vars.COMMENT_ADMIN_SECRET }} | |
| CLOUDBASE_HTTP_URL: ${{ secrets.CLOUDBASE_HTTP_URL }} | |
| TENCENTCLOUD_SECRETID: ${{ secrets.TENCENTCLOUD_SECRETID }} | |
| TENCENTCLOUD_SECRETKEY: ${{ secrets.TENCENTCLOUD_SECRETKEY }} | |
| CLOUDBASE_BUILD_FETCH: '1' | |
| run: npm run build | |
| - name: Commit if changed | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add sitemap.xml rss.xml robots.txt manifest.webmanifest data/posts.json data/search.json data/cloudbase-backup assets/og post post.html sw.js assets/dist index.html | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "build: regenerate pages with CloudBase stats [skip ci]" | |
| git push | |
| fi |