migrate db

This commit is contained in:
Jun-te Kim 2025-12-13 21:25:43 +00:00
parent e165ec3108
commit 4d0983380d
2 changed files with 29 additions and 34 deletions

View file

@ -1,34 +0,0 @@
name: Atlas Migrate (dev)
on:
push:
branches:
- main
jobs:
migrate:
runs-on: mealcraft-runners
steps:
- name: Checkout repo
uses: actions/checkout@v4
# Install Atlas
- name: Install Atlas CLI
run: |
curl -sSf https://atlasgo.sh | sh
# Load DB creds from Kubernetes secret
- name: Load Postgres credentials
run: |
export POSTGRES_USER=$(kubectl get secret postgres-secret -o jsonpath='{.data.POSTGRES_USER}' | base64 -d)
export POSTGRES_PASSWORD=$(kubectl get secret postgres-secret -o jsonpath='{.data.POSTGRES_PASSWORD}' | base64 -d)
echo "POSTGRES_USER=$POSTGRES_USER" >> $GITHUB_ENV
echo "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" >> $GITHUB_ENV
# Run Atlas migrations (DEV only)
- name: Run Atlas migrations (dev)
run: |
atlas migrate apply \
--env stripe_invoice_dev

View file

@ -57,3 +57,32 @@ jobs:
- name: Deploy Postgres backups - name: Deploy Postgres backups
run: | run: |
kubectl apply -f db/k8s/backups/ kubectl apply -f db/k8s/backups/
migrate:
runs-on: mealcraft-runners
needs: deploy
steps:
- name: Checkout repo
uses: actions/checkout@v4
# Install Atlas
- name: Install Atlas CLI
run: |
curl -sSf https://atlasgo.sh | sh
# Load DB creds from Kubernetes secret
- name: Load Postgres credentials
run: |
export POSTGRES_USER=$(kubectl get secret postgres-secret -o jsonpath='{.data.POSTGRES_USER}' | base64 -d)
export POSTGRES_PASSWORD=$(kubectl get secret postgres-secret -o jsonpath='{.data.POSTGRES_PASSWORD}' | base64 -d)
echo "POSTGRES_USER=$POSTGRES_USER" >> $GITHUB_ENV
echo "POSTGRES_PASSWORD=$POSTGRES_PASSWORD" >> $GITHUB_ENV
# Run Atlas migrations (DEV only)
- name: Run Atlas migrations (dev)
run: |
atlas migrate apply \
--env stripe_invoice_dev