Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

Migrate db automatically on release (#1476)

Will Hutchinsonc595dcf7838d
diff --git a/.github/actions/migrate-cloud-storage-db/action.yml b/.github/actions/migrate-cloud-storage-db/action.yml
index 6879992061..d146166ef4 100644
--- a/.github/actions/migrate-cloud-storage-db/action.yml
+++ b/.github/actions/migrate-cloud-storage-db/action.yml
@@ -5,40 +5,16 @@ inputs:
environment:
description: 'Environment to run migrations for (dev, prod)'
required: true
- aws-access-key:
- description: 'AWS access key'
- required: true
- aws-secret-key:
- description: 'AWS secret key'
- required: true
- aws-region:
- description: 'AWS region'
- required: false
- default: 'us-east-1'
runs:
using: composite
steps:
- uses: actions/checkout@v4
-
- - name: Configure AWS credentials
- uses: aws-actions/configure-aws-credentials@v4
with:
- aws-access-key-id: ${{ inputs.aws-access-key }}
- aws-secret-access-key: ${{ inputs.aws-secret-key }}
- aws-region: ${{ inputs.aws-region }}
-
- - name: Setup Rust
- uses: ./.github/actions/setup-rust
-
- - name: Install just
- uses: extractions/setup-just@v2
-
- - name: Install sqlx-cli
- shell: bash
- run: |
- cargo install sqlx-cli --locked --no-default-features --features postgres,rustls
-
+ sparse-checkout: |
+ .github/
+ rust/cloud-storage/macro_db_client
+
- name: Get database URL from Secrets Manager
id: get-db-url
shell: bash
diff --git a/.github/workflows/deploy-cloud-storage-on-push.yml b/.github/workflows/deploy-cloud-storage-on-push.yml
index 1dea9605b5..dd971b4e66 100644
--- a/.github/workflows/deploy-cloud-storage-on-push.yml
+++ b/.github/workflows/deploy-cloud-storage-on-push.yml
@@ -55,16 +55,16 @@ jobs:
name: Run Database Migrations
needs: detect-changes
if: ${{ needs.detect-changes.outputs.has_changes == 'true' }}
- runs-on: ubuntu-latest
+ runs-on: db-migrator
steps:
- uses: actions/checkout@v4
+ with:
+ sparse-checkout: .github/
- - name: Run migrations for dev
+ - name: Run migrations
uses: ./.github/actions/migrate-cloud-storage-db
with:
environment: dev
- aws-access-key: ${{ secrets.AWS_ACCESS_KEY }}
- aws-secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
deploy-services:
name: Deploy ${{ matrix.service }}
diff --git a/.github/workflows/migrate-macro-db.yml b/.github/workflows/migrate-macro-db.yml
index 68ad0fae9f..a20729132f 100644
--- a/.github/workflows/migrate-macro-db.yml
+++ b/.github/workflows/migrate-macro-db.yml
@@ -1,18 +1,24 @@
name: Migrate Macro Database
-
on:
workflow_dispatch:
-
+ inputs:
+ environment:
+ description: 'Environment to run migrations for'
+ required: true
+ type: choice
+ options:
+ - dev
+ - prod
jobs:
migrate-db:
- name: Run Database Migrations (dev)
- runs-on: ubuntu-latest
+ name: Run Database Migrations (${{ inputs.environment }})
+ runs-on: db-migrator
steps:
- uses: actions/checkout@v4
-
- - name: Run migrations for dev
+ with:
+ sparse-checkout: |
+ .github/
+ - name: Run migrations
uses: ./.github/actions/migrate-cloud-storage-db
with:
- environment: dev
- aws-access-key: ${{ secrets.AWS_ACCESS_KEY }}
- aws-secret-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
+ environment: ${{ inputs.environment }}
diff --git a/.github/workflows/release-production.yml b/.github/workflows/release-production.yml
index d335fd4836..4842952b54 100644
--- a/.github/workflows/release-production.yml
+++ b/.github/workflows/release-production.yml
@@ -12,8 +12,21 @@ env:
WEB_APP_VERSION: ${{ github.ref_name }}
jobs:
+ migrate-db:
+ name: Run Database Migrations
+ runs-on: db-migrator
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ sparse-checkout: .github/
+ - name: Run migrations
+ uses: ./.github/actions/migrate-cloud-storage-db
+ with:
+ environment: prod
+
deploy-cloud-storage:
name: Deploy Cloud Storage Services
+ needs: [migrate-db]
uses: ./.github/workflows/deploy-all-services.yml
with:
environment: prod