Update Sitemap #20
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: Update Sitemap | |
| on: | |
| schedule: | |
| - cron: "0 6 * * *" # Daily at 06:00 UTC | |
| workflow_dispatch: # Allow manual trigger | |
| jobs: | |
| update-sitemap: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout react app | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Checkout content repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: isaaccomputerscience/isaac-content | |
| path: content-repo | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "yarn" | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile --ignore-scripts | |
| - name: Index content dates | |
| run: yarn index-content-dates | |
| env: | |
| CONTENT_REPO_PATH: ${{ github.workspace }}/isaac-content | |
| - name: Generate sitemap | |
| run: yarn generate-sitemap | |
| env: | |
| ISAAC_ENV: production | |
| - name: Commit if changed | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add public/sitemap.xml scripts/content-dates.json | |
| git diff --cached --quiet || \ | |
| (git commit -m "chore: update sitemap [skip ci]" && git push) |