Merge pull request #46 from teacoder-team/dev #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| install: | |
| name: 📦 Install dependencies | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install | |
| build: | |
| name: 🏗️ Build Next.js | |
| runs-on: ubuntu-latest | |
| needs: install | |
| env: | |
| APP_URL: ${{ secrets.NEXT_PUBLIC_APP_URL }} | |
| API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Restore dependencies | |
| run: bun install | |
| - name: Build Next.js project | |
| run: bun run build | |
| deploy: | |
| name: 🚀 Deploy to Dokploy | |
| runs-on: ubuntu-latest | |
| needs: build | |
| env: | |
| DOKPLOY_URL: ${{ secrets.DOKPLOY_URL }} | |
| DOKPLOY_API_KEY: ${{ secrets.DOKPLOY_API_KEY }} | |
| DOKPLOY_APP_ID: ${{ secrets.DOKPLOY_APP_ID }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Deploy to Dokploy | |
| run: | | |
| echo "🚀 Deploying frontend to Dokploy..." | |
| curl -X POST "$DOKPLOY_URL/api/application.deploy" \ | |
| -H "accept: application/json" \ | |
| -H "Content-Type: application/json" \ | |
| -H "x-api-key: $DOKPLOY_API_KEY" \ | |
| -d '{ | |
| "applicationId": "'"$DOKPLOY_APP_ID"'" | |
| }' |