Skip to content

Commit a5fdc0c

Browse files
committed
Add sitemap generator
1 parent 3dd3af8 commit a5fdc0c

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Generate Sitemap
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 12 * * *'
7+
8+
jobs:
9+
generate-sitemap:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v3
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
21+
- name: Install dependencies
22+
run: npm install -g sitemap-generator-cli
23+
24+
- name: Generate sitemap
25+
run: |
26+
SITE_URL="https://docs.sei.io"
27+
28+
# Generate the sitemap
29+
npx sitemap-generator-cli $SITE_URL --filepath ./sitemap.xml --maxDepth 10 --ignoreHreflang true
30+
31+
- name: Check for changes
32+
id: git-check
33+
run: |
34+
git diff --quiet sitemap.xml || echo "changes=true" >> $GITHUB_OUTPUT
35+
36+
- name: Commit and push changes
37+
if: steps.git-check.outputs.changes == 'true'
38+
run: |
39+
git config --local user.email "action@github.com"
40+
git config --local user.name "GitHub Action"
41+
git add sitemap.xml
42+
git commit -m "Update sitemap.xml"
43+
git push

0 commit comments

Comments
 (0)