diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 417222e..9897dd2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,16 +55,28 @@ jobs: env: VITE_BACKEND_URL: http://localhost:5000 - docker-build: - name: Docker Build + deploy-frontend: + name: Deploy Frontend runs-on: ubuntu-latest needs: [backend-test, frontend-build] - if: github.ref == 'refs/heads/main' + if: github.ref == 'refs/heads/main' && github.event_name == 'push' steps: - uses: actions/checkout@v4 - - name: Build backend image - run: docker build -t syswatch-backend ./backend + - name: Deploy to Vercel + uses: amondnet/vercel-action@v25 + with: + vercel-token: ${{ secrets.VERCEL_TOKEN }} + vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} + vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} + working-directory: ./frontend + vercel-args: '--prod' - - name: Build frontend image - run: docker build --build-arg VITE_BACKEND_URL=http://localhost:5000 -t syswatch-frontend ./frontend + deploy-backend: + name: Deploy Backend + runs-on: ubuntu-latest + needs: [backend-test, frontend-build] + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + steps: + - name: Trigger Render Deploy + run: curl -X POST "${{ secrets.RENDER_DEPLOY_HOOK_URL }}" diff --git a/backend/app.py b/backend/app.py index 162dd30..e530773 100644 --- a/backend/app.py +++ b/backend/app.py @@ -10,9 +10,9 @@ app = Flask(__name__) app.config['SECRET_KEY'] = 'syswatch-secret-key-change-in-prod' -CORS(app, origins='*') +CORS(app, origins=['https://syswatch-nine.vercel.app']) -socketio = SocketIO(app, cors_allowed_origins='*', async_mode='eventlet') +socketio = SocketIO(app, cors_allowed_origins=['https://syswatch-nine.vercel.app'], async_mode='eventlet') app.register_blueprint(api_blueprint) register_handlers(socketio) diff --git a/frontend/.gitignore b/frontend/.gitignore index 3bc9467..8ee0ee9 100644 --- a/frontend/.gitignore +++ b/frontend/.gitignore @@ -22,3 +22,5 @@ coverage/ # Editor .DS_Store +.vercel +.env*.local