Fetch new feeds and push content to Github Pages #6106
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
name: Fetch new feeds and push content to Github Pages | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
paths: | |
- 'feeds.php' | |
- 'base.html' | |
schedule: | |
- cron: '0 */24 * * *' # Runs every 2 hours | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN | |
permissions: | |
id-token: write | |
contents: write | |
actions: write | |
checks: write | |
deployments: write | |
discussions: write | |
issues: write | |
pages: write | |
packages: write | |
pull-requests: write | |
repository-projects: write | |
security-events: write | |
statuses: write | |
# Allow only one concurrent deployment | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 # Updated to v4 | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 # Updated to v4 | |
- name: Run feeds.php | |
run: php feeds.php | |
- name: Commit files | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add --all | |
git commit -m "Updating the repository" || echo "No changes to commit" | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
force: true | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 # Updated to v3 | |
with: | |
path: './public' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 # Updated to v4 |