From 2643cd4621540171662972bc77bcface4021b5e0 Mon Sep 17 00:00:00 2001 From: Ali Date: Sat, 30 Aug 2025 07:58:12 +0200 Subject: [PATCH] Update .gitea/workflows/first.yml --- .gitea/workflows/first.yml | 50 +++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/first.yml b/.gitea/workflows/first.yml index b6fc4c6..4ae38dd 100644 --- a/.gitea/workflows/first.yml +++ b/.gitea/workflows/first.yml @@ -1 +1,49 @@ -hello \ No newline at end of file +name: Build & Deploy Frontend + +on: + push: + branches: [main] + +concurrency: + group: erp-prod + cancel-in-progress: true + +jobs: + build-push-deploy: + runs-on: ubuntu-latest + defaults: + run: + working-directory: frontend + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and Push Docker Image + uses: docker/build-push-action@v5 + with: + context: ./frontend + push: true + tags: naseeralisk786123/erp:latest + + - name: Deploy to Dedicated Server + uses: appleboy/ssh-action@v1.0.3 + with: + host: ${{ secrets.DEPLOY_HOST }} + username: ${{ secrets.DEPLOY_USER }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + script: | + docker pull naseeralisk786123/erp:latest + docker stop erp-container || true + docker rm erp-container || true + docker run -d \ + --name erp-container \ + -p 86:80 \ + -p 446:443 \ + naseeralisk786123/erp:latest