Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Feat(ops): Add automatic deploy when pushing to main

Jonathan ARNAULTb3f72129b576
diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml
index 6cb71941..02b5d2d6 100644
--- a/.github/workflows/check.yml
+++ b/.github/workflows/check.yml
@@ -3,7 +3,6 @@ on:
push:
branches:
- main
- - dev
pull_request:
types:
- opened
@@ -23,15 +22,15 @@ permissions:
jobs:
lint:
- name: ⬣ ESLint
+ name: πŸ”Ž ESLint
runs-on: ubuntu-latest
timeout-minutes: 10
if: ${{ !github.event.pull_request.draft || github.event_name == 'push' }}
steps:
- - name: ⬇️ Checkout repo
+ - name: πŸ“₯ Checkout repo
uses: actions/checkout@v4
- - name: βŽ” Setup node
+ - name: βš™οΈ Setup node
uses: actions/setup-node@v4
with:
node-version: 20
@@ -49,15 +48,15 @@ jobs:
prettier_args: "--config ./.prettierrc.mjs \"**/*.{js,json,ts,tsx,css,md,html}\""
build:
- name: βš™οΈ Build
+ name: πŸ”¨ Build
timeout-minutes: 10
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft || github.event_name == 'push' }}
steps:
- - name: ⬇️ Checkout repo
+ - name: πŸ“₯ Checkout repo
uses: actions/checkout@v4
- - name: βŽ” Setup node
+ - name: βš™οΈ Setup node
uses: actions/setup-node@v4
with:
node-version: 20
@@ -66,5 +65,5 @@ jobs:
- name: πŸ“₯ Download deps
run: npm install
- - name: βš™οΈ Build
+ - name: πŸ”¨ Build
run: make build
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
new file mode 100644
index 00000000..5b9af3d3
--- /dev/null
+++ b/.github/workflows/deploy.yml
@@ -0,0 +1,58 @@
+name: πŸš€ Deploy
+on:
+ push:
+ branches:
+ - main
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ cancel-in-progress: true
+
+permissions:
+ actions: write
+ contents: write
+ checks: write
+ pull-requests: write
+
+
+jobs:
+ deploy:
+ name: πŸš€ Deploy
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+
+ env:
+ SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
+ SUPABASE_DB_PASSWORD: ${{ secrets.SUPABASE_DB_PASSWORD }}
+ SUPABASE_PROJECT_ID: ${{ secrets.SUPABASE_PROJECT_ID }}
+
+ steps:
+ - name: πŸ“₯ Checkout repo
+ uses: actions/checkout@v4
+
+ - name: βš™οΈ Setup node
+ uses: actions/setup-node@v4
+ with:
+ node-version: 20
+ cache: npm
+
+ - name: βš™οΈ Setup supabase
+ uses: supabase/setup-cli@v1
+
+ - name: πŸ“₯ Download deps
+ run: npm install
+
+ - name: πŸ”¨ Build
+ run: make build
+
+ - name: πŸ”— Supabase Link
+ run: npx supabase link --project-ref $SUPABASE_PROJECT_ID
+
+ - name: πŸ“‘ Push supabase migrations
+ run: npx supabase db push
+
+ - name: πŸ“‘ Deploy supabase functions
+ run: npx supabase functions deploy
+
+ - name: πŸ“‘ Deploy GitHub pages
+ run: npm run ghpages:deploy
diff --git a/README.md b/README.md
index 35644f57..617949bb 100644
--- a/README.md
+++ b/README.md
@@ -87,4 +87,16 @@ make prod-start
Note: It will apply migrations and deploy edge functions.
-You can then access the app via [`http://localhost:3000/`](http://localhost:3000/).
\ No newline at end of file
+You can then access the app via [`http://localhost:3000/`](http://localhost:3000/).
+
+
+# GitHub Actions
+
+This project supports github actions for continuous integration and delivery. To enable GitHub actions on this repo, you will
+have to create the following secrets for the `deploy` environment:
+
+```bash
+SUPABASE_ACCESS_TOKEN: Your personal access token, can be found at https://supabase.com/dashboard/account/tokens
+SUPABASE_DB_PASSWORD: Your supabase database password
+SUPABASE_PROJECT_ID: Your supabase project id
+```
\ No newline at end of file