Skip to content

Database Export

Database Export #116

Workflow file for this run

name: Database Export
on:
workflow_dispatch: # Add a run button on GitHub
schedule:
- cron: '2 1 * * *'
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:14-alpine
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: hapi
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
--name postgres-container
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install .
- name: Run Pipeline
env:
BASIC_AUTHS: ${{ secrets.BASIC_AUTHS }}
HDX_KEY: ${{ secrets.HDX_BOT_SCRAPERS_API_TOKEN }}
run: python3.11 -m hapi.pipelines.app -db "postgresql+psycopg://postgres:postgres@localhost:5432/hapi"
- name: Dump PostgreSQL Views
run: |
./dump_views.sh
- name: Commit updated DB export
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: db-export
folder: database
target-folder: database
- name: Archive warnings and errors
uses: actions/upload-artifact@v4
with:
name: warnings-errors
path: warnings_errors.log
- name: Send slack message
if: failure()
run: |
curl -X POST -H 'Content-type: application/json' \
--data "{\"text\":\"Build failed! Check the run details: https://github.com/OCHA-DAP/hapi-pipelines-prod/actions/runs/${{ github.run_id }}\"}" \
${{ secrets.SLACK_WEBHOOK_URL }}