Skip to content

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.

Supabase remote deploy (#16)

Brad Barbin0f72f33753cb
diff --git a/.github/actions/setup-monorepo/action.yml b/.github/actions/setup-monorepo/action.yml
new file mode 100644
index 0000000000..7434fe36e3
--- /dev/null
+++ b/.github/actions/setup-monorepo/action.yml
@@ -0,0 +1,22 @@
+name: 📦 Install dependencies
+description: Prepare and install everything for the monorepo
+
+runs:
+ using: composite
+ steps:
+ - uses: actions/cache@v2
+ with:
+ path: "**/node_modules"
+ key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
+
+ - name: Setup Node.js environment
+ uses: actions/setup-node@v2
+ with:
+ cache: yarn
+ cache-dependency-path: yarn.lock
+ node-version: 18.x
+
+ - name: Install dependecies
+ if: steps.yarn-cache.outputs.cache-hit != 'true'
+ run: yarn install --frozen-lockfile
+ shell: bash
diff --git a/.github/workflows/delete-abandoned-branches.yml b/.github/workflows/delete-abandoned-branches.yml
new file mode 100644
index 0000000000..fecb8bf006
--- /dev/null
+++ b/.github/workflows/delete-abandoned-branches.yml
@@ -0,0 +1,28 @@
+name: Delete abandoned branches
+
+on:
+ # Run daily at midnight
+ schedule:
+ - cron: "0 0 * * *"
+
+ # Allow workflow to be manually run from the GitHub UI
+ workflow_dispatch:
+
+jobs:
+ cleanup_old_branches:
+ runs-on: ubuntu-latest
+ name: Satisfy my repo CDO
+ steps:
+ - name: Delete those pesky dead branches
+ uses: phpdocker-io/github-actions-delete-abandoned-branches@v1
+ id: delete_stuff
+ with:
+ github_token: ${{ github.token }}
+ last_commit_age_days: 60
+ ignore_branches: main
+
+ # Disable dry run and actually get stuff deleted
+ dry_run: no
+
+ - name: Get output
+ run: "echo 'Deleted branches: ${{ steps.delete_stuff.outputs.deleted_branches }}'"
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 0000000000..74d55129c6
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,34 @@
+name: Deploy
+
+on:
+ workflow_dispatch:
+ push:
+ branches:
+ - main
+ paths:
+ - "packages/carbon-database/**"
+ - "package-lock.json"
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ deploy:
+ name: supabase
+ runs-on: ubuntu-latest
+
+ env:
+ SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
+ SUPABASE_DB_PASSWORD: ${{ secrets.PRODUCTION_DB_PASSWORD }}
+ SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID }}
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v3
+
+ - name: 📦 Install dependencies
+ uses: ./.github/actions/setup-monorepo
+
+ - name: 🚀 Sync local database with supabase remote
+ run: yarn deploy
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
deleted file mode 100644
index ee6caba5e6..0000000000
--- a/.github/workflows/release.yml
+++ /dev/null
@@ -1,27 +0,0 @@
-name: Release
-
-on:
- push:
- branches:
- - main
- workflow_dispatch:
-
-jobs:
- deploy:
- name: 🚀 supabase
- runs-on: ubuntu-latest
-
- env:
- SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
- SUPABASE_DB_PASSWORD: ${{ secrets.PRODUCTION_DB_PASSWORD }}
- PROJECT_ID: rzthuiobyixniufffipe
-
- steps:
- - uses: actions/checkout@v3
-
- - uses: supabase/setup-cli@v1
- with:
- version: latest
-
- - run: supabase link --project-ref $PROJECT_ID
- - run: supabase db push
diff --git a/README.md b/README.md
index 2f9cd6a819..2455b4509e 100644
--- a/README.md
+++ b/README.md
@@ -57,6 +57,8 @@ The monorepo follows the Turborepo covention of grouping packages into one of tw
## Local Development
+<!-- TODO: requirements for Upstash, Supabase, Github -->
+
Make sure that you have [Docker installed](https://docs.docker.com/desktop/install/mac-install/) and [yarn installed](https://yarnpkg.com/lang/en/docs/install/#debian-stable)
on your system since this monorepo uses the yarn package manager.
diff --git a/package.json b/package.json
index 0777f2a81c..91d9085527 100755
--- a/package.json
+++ b/package.json
@@ -26,6 +26,7 @@
"db:pull": "turbo run db:pull",
"db:seed": "turbo run db:seed --no-cache",
"db:migrate:force": "turbo run db:migrate:force --no-cache",
+ "deploy": "turbo run deploy",
"dev": "turbo run dev --no-cache --parallel --continue --filter=./apps/* --filter=./packages/*",
"dev:apps": "turbo run dev --no-cache --parallel --continue --filter=./apps/*",
"dev:docs": "turbo run dev --no-cache --parallel --continue --filter=./docs/*",
diff --git a/turbo.json b/turbo.json
index ea2e288aeb..90ed35ddae 100644
--- a/turbo.json
+++ b/turbo.json
@@ -20,6 +20,10 @@
"clean": {
"cache": false
},
+ "deploy": {
+ "dependsOn": ["^build"],
+ "cache": false
+ },
"db:start": {
"outputs": []
},