Skip to content

Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.

feat: add GitHub Actions workflows for automatic backend and frontend deployment

valzorb6158d66bbd8
diff --git a/.github/workflows/deploy-backend.yml b/.github/workflows/deploy-backend.yml
new file mode 100644
index 0000000..f811a18
--- /dev/null
+++ b/.github/workflows/deploy-backend.yml
@@ -0,0 +1,22 @@
+name: Deploy Backend
+
+on:
+ push:
+ branches: [main]
+ paths:
+ - 'backend/**'
+ - '.github/workflows/deploy-backend.yml'
+
+jobs:
+ deploy:
+ runs-on: ubuntu-latest
+ name: Deploy Cloudflare Worker
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Deploy Worker
+ uses: cloudflare/wrangler-action@v3
+ with:
+ apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
+ accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
+ workingDirectory: backend
diff --git a/.github/workflows/deploy-frontend.yml b/.github/workflows/deploy-frontend.yml
new file mode 100644
index 0000000..026db11
--- /dev/null
+++ b/.github/workflows/deploy-frontend.yml
@@ -0,0 +1,41 @@
+name: Deploy Frontend
+
+on:
+ push:
+ branches: [main]
+ paths:
+ - 'frontend/**'
+ - '.github/workflows/deploy-frontend.yml'
+
+jobs:
+ deploy:
+ runs-on: ubuntu-latest
+ name: Deploy Cloudflare Pages
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 20
+ cache: 'npm'
+ cache-dependency-path: frontend/package-lock.json
+
+ - name: Install dependencies
+ working-directory: frontend
+ run: npm ci
+
+ - name: Build
+ working-directory: frontend
+ run: npm run build
+ env:
+ VITE_SUPABASE_URL: ${{ secrets.VITE_SUPABASE_URL }}
+ VITE_SUPABASE_ANON_KEY: ${{ secrets.VITE_SUPABASE_ANON_KEY }}
+ VITE_API_URL: ${{ secrets.VITE_API_URL }}
+
+ - name: Deploy to Cloudflare Pages
+ uses: cloudflare/wrangler-action@v3
+ with:
+ apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
+ accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
+ command: pages deploy dist --project-name=twiligent --commit-dirty=true
+ workingDirectory: frontend