From cdba0885408631a6f255c19caa7e8091ccb6ea7d Mon Sep 17 00:00:00 2001 From: "Arija A." Date: Tue, 14 Oct 2025 17:17:56 +0300 Subject: [PATCH] Add sitemap CI/CD Signed-off-by: Arija A. --- .forgejo/workflows/sitemap.yml | 40 ++++++++++++++++++++++++++++++++++ sitemap.sh | 13 +++++++++++ 2 files changed, 53 insertions(+) create mode 100644 .forgejo/workflows/sitemap.yml create mode 100755 sitemap.sh diff --git a/.forgejo/workflows/sitemap.yml b/.forgejo/workflows/sitemap.yml new file mode 100644 index 0000000..ab9ef4c --- /dev/null +++ b/.forgejo/workflows/sitemap.yml @@ -0,0 +1,40 @@ +on: + push: + paths: + - "pages/**" + - "sitemap.sh" + +jobs: + stats: + runs-on: ubuntu-latest + container: catthehacker/ubuntu:act-latest + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GIT_TOKEN }} + + - name: Set up repository + id: check_commit + run: | + git reset --hard + git pull + git reset --hard + + - name: Generate sitemap + run: | + sh ./sitemap.sh + + - name: Stage the changes + run: | + git add sitemap.xml + + - name: Commit and Push Changes + run: | + if git diff --staged --quiet; then + echo "No changes to commit." + else + git config --local user.email "sitemap@localhost" + git config --local user.name "Sitemap CI/CD" + git commit -am "[skip ci] Update sitemap" || echo "No changes to commit" + git push origin HEAD -f + fi diff --git a/sitemap.sh b/sitemap.sh new file mode 100755 index 0000000..aac0ef6 --- /dev/null +++ b/sitemap.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +set -eu + +main() { + echo "" + find pages/ -name '*.xhtml' | while read -r file; do + echo "https://purplebored.pl/${file}1.0" + done + echo "" +} + +main >sitemap.xml