Update universes #88
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 universes | |
on: | |
schedule: | |
# this should run right after most of harvesting is finished on data.gouv.fr | |
- cron: '4 5 * * *' | |
workflow_dispatch: | |
jobs: | |
run-demo-update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Update demo universe | |
env: | |
DATAGOUV_URL: https://demo.data.gouv.fr | |
DATAGOUV_API_KEY: ${{ secrets.DATAGOUV_API_KEY_DEMO }} | |
run: | | |
python -u feed-universe.py config-demo.yaml 2>&1 | tee logs/run_log_demo.txt | |
- name: Commit artifacts | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add logs/run_log_demo.txt | |
git commit -m "Update daily run log for demo" | |
git add dist/organizations-demo.json | |
git diff-index --cached --quiet HEAD || git commit -m "Update organizations JSON for demo" | |
- name: Push changes | |
run: | | |
git pull --rebase origin ${{ github.ref_name }} | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run-prod-update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Update prod universe | |
env: | |
DATAGOUV_URL: https://www.data.gouv.fr | |
DATAGOUV_API_KEY: ${{ secrets.DATAGOUV_API_KEY_PROD }} | |
run: | | |
python -u feed-universe.py config-prod.yaml 2>&1 | tee logs/run_log_prod.txt | |
- name: Commit artifacts | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add logs/run_log_prod.txt | |
git commit -m "Update daily run log for prod" | |
git add dist/organizations-prod.json | |
git diff-index --cached --quiet HEAD || git commit -m "Update organizations JSON for prod" | |
- name: Push changes | |
run: | | |
git pull --rebase origin ${{ github.ref_name }} | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |