Skip to content

Update RSS Feed

Update RSS Feed #9

Workflow file for this run

name: Update RSS Feed
on:
schedule:
- cron: '0 0 * * 1'
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
update-rss:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
bundler-cache: true
- name: Generate RSS entry
run: |
bundle exec ruby lib/generate_rss.rb
- name: Commit and push changes
id: commit
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
WEEK_DATE=$(date -u +%Y-%m-%d)
git add source/data/rss_entries.yml
if ! git diff --staged --quiet; then
git commit -m "Update RSS feed for week beginning $WEEK_DATE"
git push
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "No changes to commit"
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Setup Pages
if: steps.commit.outputs.changed == 'true'
uses: actions/configure-pages@v5
- name: Build site
if: steps.commit.outputs.changed == 'true'
run: |
bundle exec middleman build
- name: Upload artifact
if: steps.commit.outputs.changed == 'true'
uses: actions/upload-pages-artifact@v4
with:
path: build
- name: Deploy to GitHub Pages
if: steps.commit.outputs.changed == 'true'
id: deployment
uses: actions/deploy-pages@v4