Refresh ICS file #1331
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: Refresh ICS file | |
on: | |
schedule: | |
- cron: '37 13 * * *' | |
workflow_dispatch: | |
jobs: | |
fetch: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install dependencies | |
run: sudo apt-get install libxml2-dev libxslt-dev | |
- uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
cache: 'pip' | |
- run: pip install -r requirements.txt | |
- name: Fetch data and produce prodcal.ics | |
run: python prodcal_ics.py --start-year=2018 -o /tmp/prodcal.ics | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: prodcal.ics | |
path: /tmp/prodcal.ics | |
upload: | |
runs-on: ubuntu-latest | |
needs: fetch | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: gh-pages | |
- uses: actions/download-artifact@v2 | |
with: | |
name: prodcal.ics | |
- name: Push changes if any | |
run: | | |
if [[ $(git status -s prodcal.ics) ]]; then | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add prodcal.ics && \ | |
git commit -m "Update prodcal.ics" && \ | |
git push | |
fi |