name: Build & Push Docker Images run-name: ${{ gitea.actor }} - ${{ gitea.ref }} on: push: branches: - main jobs: test-backend: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '24' cache: 'npm' - name: Install dependencies run: npm ci - name: Run tests run: npm test --workspace=farma-clic-backend -- --ci test-frontend: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '24' cache: 'npm' - name: Install dependencies run: npm ci - name: Run tests run: npm test --workspace=farma-clic-frontend -- --run --reporter=basic build-backend: needs: [ test-backend, test-frontend ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Log in to Gitea registry uses: docker/login-action@v3 with: registry: git.hacecalor.net username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build and push backend image uses: docker/build-push-action@v5 with: context: . file: ./apps/backend/Dockerfile push: true tags: | git.hacecalor.net/ichitux/farmafinder-backend:latest git.hacecalor.net/ichitux/farmafinder-backend:${{ gitea.sha }} build-frontend: needs: [ test-backend, test-frontend ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Log in to Gitea registry uses: docker/login-action@v3 with: registry: git.hacecalor.net username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build and push frontend image uses: docker/build-push-action@v5 with: context: ./apps/frontend push: true tags: | git.hacecalor.net/ichitux/farmafinder-frontend:latest git.hacecalor.net/ichitux/farmafinder-frontend:${{ gitea.sha }} deploy: needs: [ build-backend, build-frontend ] runs-on: ubuntu-latest steps: - name: SSH to remote server uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} password: ${{ secrets.PASSWORD }} port: ${{ secrets.PORT }} script: | cd /docker/FarmaFinder git pull docker compose pull docker compose up -d