Skip to content

Generate sitemap

Generate sitemap #2

name: Generate sitemap
on:
push:
branches: [ main ]
paths:
- '**/*.md'
- '**/*.html'
- '_config.yml'
- 'Gemfile'
- 'Gemfile.lock'
- '_includes/**'
- '_sass/**'
workflow_dispatch:
jobs:
sitemap:
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate the sitemap
id: sitemap
uses: cicirello/generate-sitemap@v1
with:
base-url-path: https://cairnrpg.com
- name: Output stats
run: |
echo "sitemap-path = ${{ steps.sitemap.outputs.sitemap-path }}"
echo "url-count = ${{ steps.sitemap.outputs.url-count }}"
echo "excluded-count = ${{ steps.sitemap.outputs.excluded-count }}"
- name: Commit and push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ `git status --porcelain sitemap.xml` ]]; then
git config --global user.name 'Yochai Gal'
git config --global user.email 'yochaigal@users.noreply.github.com'
git add sitemap.xml
git commit -m "Automated sitemap update" sitemap.xml
git push
fi