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: Update Contentful data and sitemap on release | |
on: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: '0 */1 * * *' | |
branches: | |
- master | |
jobs: | |
fetch-data: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Fetch Contentful data | |
run: SPACE_ID=${{secrets.CONTENTFUL_SPACE_ID}} ACCESS_TOKEN=${{secrets.CONTENTFUL_ACCESS_TOKEN}} node ./contentful.js | |
- name: Update sitemap | |
run: node ./sitemap.js | |
- name: Commit to GitHub | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
git add contentfulEntries.json sitemap.txt | |
git commit -m "Update Contentful data & sitemap" || echo "Nothing to commit" | |
git push --no-verify |