Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
ci: sync self-hosted functions should depend on deploy apps (#1126)
Carbon Agent40b6682b48c5
diff --git a/.github/workflows/functions.yml b/.github/workflows/functions.ymlindex daef4c8946..1501b081dd 100644--- a/.github/workflows/functions.yml+++ b/.github/workflows/functions.yml@@ -1,15 +1,22 @@name: Deploy Self-Hosted Functionson:- push:- branches: [main]- paths: ["packages/database/supabase/functions/**"]+ # Run after the Deploy Apps workflow completes so functions sync only once the+ # app deploy has finished (avoids racing ECS/infra changes).+ workflow_run:+ workflows: ["Deploy Apps"]+ types:+ - completed+ branches:+ - mainworkflow_dispatch:jobs:functions:name: Deploy Self-Hosted Functionsruns-on: ubuntu-latest+ # Only run if the triggering Deploy Apps workflow succeeded (or if manually triggered)+ if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}strategy:matrix:environment:@@ -22,9 +29,34 @@ jobs:INSTANCE_SSH_KEY: ${{ secrets[matrix.environment.instance_ssh_key] }}steps:- - uses: actions/checkout@v4+ - name: Checkout code+ uses: actions/checkout@v4+ with:+ # Check out the commit that triggered the deploy so the path filter+ # inspects the right changes (workflow_run does not set the ref for us).+ ref: ${{ github.event.workflow_run.head_sha || github.ref }}+ fetch-depth: 0++ # workflow_run does not support path filters natively, so check whether the+ # triggering commit actually touched the edge functions. Skipped for manual runs.+ - name: Check for function changes+ id: filter+ if: ${{ github.event_name == 'workflow_run' }}+ uses: dorny/paths-filter@v3+ with:+ base: ${{ github.event.workflow_run.head_sha }}~1+ ref: ${{ github.event.workflow_run.head_sha }}+ filters: |+ functions:+ - 'packages/database/supabase/functions/**'++ # Give ECS / infra a moment to stabilize after the deploy. Skipped for manual runs.+ - name: Wait for infrastructure to stabilize+ if: ${{ github.event_name == 'workflow_run' && steps.filter.outputs.functions == 'true' }}+ run: sleep 60- name: Setup SSH key+ if: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.functions == 'true' }}run: |mkdir -p ~/.sshecho "$INSTANCE_SSH_KEY" > ~/.ssh/id_rsa@@ -32,10 +64,11 @@ jobs:ssh-keyscan -H $INSTANCE_HOST >> ~/.ssh/known_hosts- name: Deploy functions+ if: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.functions == 'true' }}run: |ssh ubuntu@$INSTANCE_HOST 'sudo bash /home/ubuntu/supabase/sync-carbon-functions.sh'- name: Cleanup SSH key- if: always()+ if: ${{ always() && (github.event_name == 'workflow_dispatch' || steps.filter.outputs.functions == 'true') }}run: |rm -f ~/.ssh/id_rsa