@@ -14,52 +14,19 @@ jobs:
1414 - name : Checkout repo
1515 uses : actions/checkout@v4
1616
17- - name : Set up Python
17+ - name : Set up Python 3
1818 uses : actions/setup-python@v5
1919 with :
20- python-version : 3.11
20+ python-version : 3.x
2121
22- - name : Generate RSS item
22+ - name : Generate RSS feed from PDFs
2323 run : |
24- mkdir -p docs
25- RSS_FILE=docs/rss.xml
24+ python generate_rss.py
2625
27- echo "Generating RSS item..."
28-
29- # Extract last commit info
30- COMMIT_HASH=$(git log -1 --format=%H)
31- COMMIT_MSG=$(git log -1 --format=%s)
32- COMMIT_DATE=$(git log -1 --format=%cI)
33- COMMIT_URL="https://github.com/${{ github.repository }}/commit/$COMMIT_HASH"
34-
35- # Check if rss.xml exists
36- if [ ! -f "$RSS_FILE" ]; then
37- echo "Creating new rss.xml"
38- cat <<EOF > $RSS_FILE
39- <?xml version="1.0" encoding="UTF-8" ?>
40- <rss version="2.0">
41- <channel>
42- <title>Modern C++ Tutorials - Docs Updates</title>
43- <link>https://github.com/${{ github.repository }}</link>
44- <description>New articles and updates in the docs/ folder</description>
45- </channel>
46- </rss>
47- fi
48-
49- # Insert new item before </channel>
50- TMP_FILE=$(mktemp)
51- sed "/<\/channel>/ i\
52- <item>\n\
53- <title>$COMMIT_MSG</title>\n\
54- <link>$COMMIT_URL</link>\n\
55- <guid>$COMMIT_URL</guid>\n\
56- <pubDate>$COMMIT_DATE</pubDate>\n\
57- </item>" "$RSS_FILE" > "$TMP_FILE" && mv "$TMP_FILE" "$RSS_FILE"
58-
59- - name : Commit and push rss.xml
26+ - name : Commit and push updated rss.xml
6027 run : |
6128 git config user.name "github-actions[bot]"
6229 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
6330 git add docs/rss.xml
64- git commit -m "Update RSS feed for docs/ changes " || echo "No changes to commit"
31+ git commit -m "Update RSS feed with new article " || echo "No changes to commit"
6532 git push
0 commit comments