Repository navigation
merge(main): 解决 PR #102 与 main 的冲突 #561
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' | ||
| - 'assets/js/config.js' | ||
| - 'assets/js/post.js' | ||
| - 'post.html' | ||
| - 'index.html' | ||
| - 'scripts/build.mjs' | ||
| - 'scripts/markdown-render.mjs' | ||
| - 'scripts/prerender-post-html.mjs' | ||
| - 'package.json' | ||
| - 'package-lock.json' | ||
| - 'sw.js' | ||
| - 'tools/**' | ||
| - 'tool-*.html' | ||
| - 'tools.html' | ||
| - 'tool-kit.html' | ||
| - 'scripts/generate-tool-pages.mjs' | ||
| - 'scripts/tool-page-shell.mjs' | ||
| - '.github/workflows/build.yml' | ||
| workflow_dispatch: | ||
| permissions: | ||
| contents: write | ||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| 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: Generate sitemap / rss / prerender posts | ||
| 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 assets/og post post.html sw.js | ||
| git add index.html | ||
| if git diff --cached --quiet; then | ||
| echo "No changes to commit" | ||
| else | ||
| git commit -m "build: regenerate sitemap / rss [skip ci]" | ||
| git push | ||
| fi | ||