diff --git a/.github/workflows/backend-build.yml b/.github/workflows/backend-build.yml index 37f0494a..d421fa59 100644 --- a/.github/workflows/backend-build.yml +++ b/.github/workflows/backend-build.yml @@ -79,8 +79,9 @@ jobs: file: docker/backend/Dockerfile target: runtime push: true - tags: | - xor1234/backend-mln:latest + tags: xor1234/backend-mln:latest + cache-from: type=gha,scope=backend-runtime + cache-to: type=gha,mode=max,scope=backend-runtime - name: Build & push WAF uses: docker/build-push-action@v6 @@ -89,5 +90,23 @@ jobs: file: docker/backend/Dockerfile target: waf push: true - tags: | - xor1234/backend-mln:waf + tags: xor1234/backend-mln:waf + cache-from: type=gha,scope=backend-waf + cache-to: type=gha,mode=max,scope=backend-waf + + deploy: + name: Deploy to server + needs: docker + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/pre-prod' + + steps: + - name: SSH deploy + uses: appleboy/ssh-action@v1 + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_USER }} + key: ${{ secrets.SERVER_SSH_KEY }} + script: | + docker compose -f ${{ secrets.COMPOSE_PATH }} pull backend waf + docker compose -f ${{ secrets.COMPOSE_PATH }} up -d --no-deps backend waf diff --git a/.github/workflows/frontend-web-build.yml b/.github/workflows/frontend-web-build.yml index fc969208..b84857b1 100644 --- a/.github/workflows/frontend-web-build.yml +++ b/.github/workflows/frontend-web-build.yml @@ -88,7 +88,23 @@ jobs: context: . file: docker/frontend/Dockerfile push: true - tags: | - xor1234/frontend-mln:latest + tags: xor1234/frontend-mln:latest build-args: | VITE_TOMTOM_API_KEY=${{ secrets.VITE_TOMTOM_API_KEY }} + + deploy: + name: Deploy to server + needs: docker + runs-on: ubuntu-latest + if: github.event_name == 'push' && github.ref == 'refs/heads/pre-prod' + + steps: + - name: SSH deploy + uses: appleboy/ssh-action@v1 + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_USER }} + key: ${{ secrets.SERVER_SSH_KEY }} + script: | + docker compose -f ${{ secrets.COMPOSE_PATH }} pull frontend + docker compose -f ${{ secrets.COMPOSE_PATH }} up -d --no-deps frontend