Skip to content

GitAuto: Make our sitemap dynamic by automatically including each page on GitHub actions #6

GitAuto: Make our sitemap dynamic by automatically including each page on GitHub actions

GitAuto: Make our sitemap dynamic by automatically including each page on GitHub actions #6

name: Generate Sitemap
on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: main
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
- name: Install dependencies
run: npm install
- name: Install next-sitemap
run: npm install next-sitemap
- name: Generate Sitemap
run: npx next-sitemap
- name: Commit sitemap
run: |
git config --local user.name 'github-actions'
git config --local user.email '[email protected]'
git add ./app/sitemap.xml
git commit -m 'chore: update sitemap' || echo 'No changes to commit'
git push origin HEAD