Skip to content

Commit db67df0

Browse files
authored
Create xml.yml
1 parent 35a446e commit db67df0

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

.github/workflows/xml.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Update Feed on Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
update-feed:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
with:
18+
token: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '20'
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Generate XML files
29+
run: npm run xml
30+
31+
- name: Check for changes
32+
id: verify-changed-files
33+
run: |
34+
if [ -n "$(git status --porcelain static/feed.xml static/sitemap.xml)" ]; then
35+
echo "changed=true" >> $GITHUB_OUTPUT
36+
else
37+
echo "changed=false" >> $GITHUB_OUTPUT
38+
fi
39+
40+
- name: Commit and push changes
41+
if: steps.verify-changed-files.outputs.changed == 'true'
42+
run: |
43+
git config --local user.email "action@github.com"
44+
git config --local user.name "GitHub Action"
45+
git add static/feed.xml static/sitemap.xml
46+
git commit -m "Update feed and sitemap for release ${{ github.ref_name }}"
47+
git push

0 commit comments

Comments
 (0)