Skip to content

Dump GLVD Postgres Snapshot #35

Dump GLVD Postgres Snapshot

Dump GLVD Postgres Snapshot #35

name: Dump GLVD Postgres Snapshot
on:
workflow_dispatch:
jobs:
dump-db-snapshot:
runs-on: ubuntu-latest
container: ghcr.io/gardenlinux/glvd:edge
env:
PGUSER: glvd
PGDATABASE: glvd
PGPASSWORD: glvd
PGHOST: postgres
PGPORT: 5432
services:
postgres:
image: ghcr.io/gardenlinux/glvd-postgres:edgenotls
env:
POSTGRES_USER: glvd
POSTGRES_DB: glvd
POSTGRES_PASSWORD: glvd
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Check out repository code
uses: actions/checkout@v4
- uses: oras-project/setup-oras@v1
- name: Ingest Data
run: /usr/local/src/ingest-postgres.sh
- run: |
echo "$PGHOST:$PGPORT:$PGDATABASE:$PGUSER:$PGPASSWORD" > ~/.pgpass
chmod 0600 ~/.pgpass
- run: psql glvd -f extra-schema.sql
- name: Dump Database Snapshot
run: |
pg_dump -h postgres -p 5432 -U glvd glvd > glvd.sql
- name: Dump Database Schema
run: |
pg_dump --schema-only -h postgres -p 5432 -U glvd glvd > glvd-schema.sql
- run: oras login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
- run: oras push ghcr.io/gardenlinux/glvd-db-snapshot:latest glvd.sql
- run: oras logout ghcr.io
- uses: actions/upload-artifact@v4
with:
name: glvd.sql
path: glvd.sql
retention-days: 2
- uses: actions/upload-artifact@v4
with:
name: glvd-schema.sql
path: glvd-schema.sql
retention-days: 2