Skip to content

Commit

Permalink
Attempting to fix RSS generation
Browse files Browse the repository at this point in the history
  • Loading branch information
latenitefilms committed Jul 18, 2023
1 parent f24664f commit b7a9be4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 943 deletions.
6 changes: 3 additions & 3 deletions .github/scripts/generate-rss.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ function entriesAreEqual(entry1, entry2) {

let oldFeedItems = [];

if (fs.existsSync('docs/rss.xml')) {
const rssContent = fs.readFileSync('docs/rss.xml');
if (fs.existsSync('rss.xml')) {
const rssContent = fs.readFileSync('rss.xml');
const $ = cheerio.load(rssContent, { xmlMode: true });
$('item').each((i, elem) => {
oldFeedItems.push({
Expand Down Expand Up @@ -134,5 +134,5 @@ if (isContentChanged) {
newXMLContent = newXMLContent.replace(/<lastBuildDate>.*<\/lastBuildDate>/, `<lastBuildDate>${newLastBuildDate}</lastBuildDate>`);
newXMLContent = newXMLContent.replace(/{target=&quot;_blank&quot;}/g, '');
newXMLContent = newXMLContent.replace(/\.\.\/static\//g, 'https://fcp.cafe/static/');
fs.writeFileSync('docs/rss.xml', newXMLContent);
fs.writeFileSync('rss.xml', newXMLContent);
}
29 changes: 11 additions & 18 deletions .github/workflows/retype-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Switch to retype branch and pull the latest
run: |
git checkout retype
git pull origin retype
- name: Set up Node.js
uses: actions/setup-node@v3
with:
Expand All @@ -131,18 +136,10 @@ jobs:

- name: Commit and push if it's necessary
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git stash
git pull --rebase origin main
git stash pop
if git diff --exit-code --quiet docs/rss.xml; then
echo "No changes to commit"
else
git add docs/rss.xml
git commit -m "Update rss.xml"
git push
fi
git reset --hard
git clean -fd
git checkout retype
git pull origin retype
publish:
name: Publish to retype branch
Expand All @@ -162,10 +159,6 @@ jobs:
name: docs
path: docs/

- name: Copy rss.xml to a temporary location
run: |
cp docs/rss.xml /tmp/rss.xml
- name: Build and publish using Retype
uses: retypeapp/action-build@latest
with:
Expand All @@ -187,9 +180,9 @@ jobs:
git config --local user.name "GitHub Action"
git pull origin retype
- name: Copy rss.xml from the temporary location to retype branch
- name: Move rss.xml to retype branch
run: |
cp /tmp/rss.xml ./rss.xml
mv docs/rss.xml ./rss.xml
- name: Commit and push if it's necessary
run: |
Expand Down
Loading

0 comments on commit b7a9be4

Please sign in to comment.