-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
72 additions
and
38 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Update universe (base) | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
env-name: | ||
description: Name of the environment (demo or prod) | ||
required: true | ||
type: string | ||
env-config-file: | ||
description: Name of the universe configuration file | ||
required: true | ||
type: string | ||
datagouv-url: | ||
description: URL of the data.gouv.fr instance | ||
required: true | ||
type: string | ||
api-key-secret: | ||
description: Secret containing the API key | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
update-universe: | ||
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 universe | ||
env: | ||
DATAGOUV_URL: ${{ inputs.datagouv-url }} | ||
DATAGOUV_API_KEY: ${{ secrets[inputs.api-key-secret] }} | ||
run: | | ||
python -u feed-universe.py ${{ inputs.env-config-file }} --dry-run 2>&1 | tee logs/run_log_${{ inputs.env-name }}.txt | ||
- name: Commit Run Logs | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add logs/run_log_${{ inputs.env-name }}.txt | ||
git commit -m "Update daily run log for ${{ inputs.env-name }}" | ||
- name: Push changes | ||
run: | | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,53 +2,29 @@ name: Update universes | |
|
||
on: | ||
schedule: | ||
- cron: '27 5 * * *' | ||
- cron: '27 7 * * *' | ||
# FIXME: remove | ||
push: | ||
branches: | ||
- feat/ci | ||
|
||
jobs: | ||
|
||
run-update: | ||
update-universes: | ||
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 universe-demo.yaml --dry-run 2>&1 | tee logs/run_log_demo.txt | ||
uses: ./.github/workflows/update-universes-base.yml | ||
with: | ||
env-name: demo | ||
env-config-file: universe-demo.yaml | ||
datagouv-url: https://demo.data.gouv.fr | ||
api-key-secret: DATAGOUV_API_KEY_DEMO | ||
|
||
- 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 universe-prod.yaml --dry-run 2>&1 | tee logs/run_log_prod.txt | ||
- name: Commit Run Logs | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add logs/ | ||
git commit -m "Update daily run logs" | ||
- name: Push changes | ||
run: | | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: ./.github/workflows/update-universes-base.yml | ||
with: | ||
env-name: prod | ||
env-config-file: universe-prod.yaml | ||
datagouv-url: https://www.data.gouv.fr | ||
api-key-secret: DATAGOUV_API_KEY_PROD |