database #988
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: "database" | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 4 * * *" | |
env: | |
CURRENT_SEMESTER: 20242 | |
jobs: | |
update-db: | |
name: Update database | |
runs-on: ubuntu-latest | |
container: | |
image: caravelahc/matrufsc:latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Generate | |
run: | | |
virtualenv --python=/usr/bin/python2 .venv | |
source .venv/bin/activate | |
pip install bs4 | |
cd db/src | |
./get_turmas.py ${CURRENT_SEMESTER} | |
./parse_turmas.py ${CURRENT_SEMESTER}_*.xml ${CURRENT_SEMESTER}.json | |
git fetch | |
git checkout gh-pages | |
mv ${CURRENT_SEMESTER}.json ../../data/${CURRENT_SEMESTER}.json | |
git config user.email [email protected] | |
git config user.name caravelabot | |
git remote add pages https://caravelabot:${DEPLOY_ACCESS_TOKEN}@github.com/caravelahc/beta-matrufsc.git | |
git add -f ../../data/*.json || true | |
git commit -m "Update $(${CURRENT_SEMESTER}).json" || true | |
git push pages gh-pages -f |