Skip to content

Update universes

Update universes #446

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 uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Install dependencies
run: uv sync
- name: Update demo universe
env:
DATAGOUV_URL: https://demo.data.gouv.fr
DATAGOUV_API_KEY: ${{ secrets.DATAGOUV_API_KEY_DEMO }}
PYTHONUNBUFFERED: 1
run: |
uv run ecospheres-universe feed-universe config-demo.yaml --fail-on-errors 2>&1 | tee logs/run_log_demo.txt
exit ${PIPESTATUS[0]}
- 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 uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Install dependencies
run: uv sync
- name: Update prod universe
env:
DATAGOUV_URL: https://www.data.gouv.fr
DATAGOUV_API_KEY: ${{ secrets.DATAGOUV_API_KEY_PROD }}
PYTHONUNBUFFERED: 1
run: |
uv run ecospheres-universe feed-universe config-prod.yaml --fail-on-errors 2>&1 | tee logs/run_log_prod.txt
exit ${PIPESTATUS[0]}
- 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 }}