Publish RSS feeds to GitHub Pages #14567
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# all credit to Vinnl for this GitHub action and idea - original source https://github.com/Vinnl/feeds | |
name: Publish RSS feeds to GitHub Pages | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 */1 * * *' | |
workflow_dispatch: | |
env: | |
CI: true | |
jobs: | |
publish-feeds: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: '^1.21' # The Go version to download (if necessary) and use. | |
# GitHub Actions unfortunately does not support retries; | |
# this is a cumbersome method of retrying twice in case of errors: | |
- run: go run main.go || go run main.go || go run main.go | |
- name: Deploy to GitHub Pages | |
run: | | |
git config user.name $GITHUB_ACTOR | |
git config user.email [email protected] | |
git remote add gh-pages-remote https://x-access-token:[email protected]/$GITHUB_REPOSITORY.git | |
git fetch --no-recurse-submodules | |
git worktree add ./gh-pages gh-pages | |
cd gh-pages | |
git rm -r --ignore-unmatch . | |
ls ../public/ && cp -r ../public/. . && git add . | |
git commit --message="Deploying to GitHub Pages from $GITHUB_SHA" | |
git push gh-pages-remote gh-pages:gh-pages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_REPOSITORY: ${{ github.repository }} |