Skip to content

Database Export

Database Export #378

Workflow file for this run

name: Database Export
on:
workflow_dispatch: # Add a run button on GitHub
release:
types: [published]
schedule:
- cron: "2 22,11 * * *"
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:
HDX_SITE: ${{ vars.HDX_SITE }}
HDX_KEY: ${{ secrets.HDX_BOT_SCRAPERS_API_TOKEN }}
PREPREFIX: ${{ secrets.HDX_PIPELINE_PREPREFIX }}
USER_AGENT: ${{ secrets.USER_AGENT }}
BASIC_AUTHS: ${{ secrets.BASIC_AUTHS }}
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 mail
if: failure()
uses: dawidd6/action-send-mail@v3
with:
server_address: ${{secrets.EMAIL_SERVER}}
server_port: ${{secrets.EMAIL_PORT}}
username: ${{secrets.EMAIL_USERNAME}}
password: ${{secrets.EMAIL_PASSWORD}}
subject: "FAILED: ${{github.repository}} database export job"
body: GitHub Actions database export job for ${{github.repository}} failed!
to: ${{secrets.EMAIL_LIST}}
from: ${{secrets.EMAIL_FROM}}
content_type: text/html