From 37199521e499db3e474bf3f357a57bfcdc31309e Mon Sep 17 00:00:00 2001 From: Rassaby Ludovic Date: Thu, 16 Oct 2025 13:23:51 +0400 Subject: [PATCH] =?UTF-8?q?feat:=20Ajout=20workflows=20de=20d=C3=A9ploieme?= =?UTF-8?q?nt=20automatique?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Ajout workflow de déploiement sur Render - Ajout workflow de déploiement sur serveur Linux - Configuration pour déploiement automatique avec tags - Prêt pour déploiement en production --- .github/workflows/deploy-render.yml | 31 ++++++++++++++ .github/workflows/deploy-server.yml | 57 +++++++++++++++++++++++++ .github/workflows/docker-build-push.yml | 2 +- 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy-render.yml create mode 100644 .github/workflows/deploy-server.yml diff --git a/.github/workflows/deploy-render.yml b/.github/workflows/deploy-render.yml new file mode 100644 index 0000000..888571d --- /dev/null +++ b/.github/workflows/deploy-render.yml @@ -0,0 +1,31 @@ +name: 🚀 Deploy to Render + +on: + push: + tags: [ 'v*' ] + workflow_dispatch: + +env: + RENDER_SERVICE_ID: ${{ secrets.RENDER_SERVICE_ID }} + RENDER_API_KEY: ${{ secrets.RENDER_API_KEY }} + +jobs: + deploy: + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + + steps: + - name: 📥 Checkout repository + uses: actions/checkout@v4 + + - name: 🚀 Deploy to Render + uses: johnbeynon/render-deploy-action@v0.0.8 + with: + service-id: ${{ env.RENDER_SERVICE_ID }} + api-key: ${{ env.RENDER_API_KEY }} + wait-for-success: true + + - name: ✅ Deployment successful + run: | + echo "🎉 Application deployed successfully to Render!" + echo "🌐 Your app is now accessible publicly" diff --git a/.github/workflows/deploy-server.yml b/.github/workflows/deploy-server.yml new file mode 100644 index 0000000..0777919 --- /dev/null +++ b/.github/workflows/deploy-server.yml @@ -0,0 +1,57 @@ +name: 🚀 Deploy to Linux Server + +on: + push: + tags: [ 'v*' ] + workflow_dispatch: + +env: + SERVER_HOST: ${{ secrets.SERVER_HOST }} + SERVER_USER: ${{ secrets.SERVER_USER }} + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + +jobs: + deploy: + runs-on: ubuntu-latest + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + + steps: + - name: 📥 Checkout repository + uses: actions/checkout@v4 + + - name: 🔐 Setup SSH + uses: webfactory/ssh-agent@v0.7.0 + with: + ssh-private-key: ${{ env.SSH_PRIVATE_KEY }} + + - name: 🚀 Deploy to server + run: | + ssh -o StrictHostKeyChecking=no ${{ env.SERVER_USER }}@${{ env.SERVER_HOST }} << 'EOF' + # Navigate to project directory + cd /opt/dockezr + + # Pull latest changes + git fetch origin + git checkout ${{ github.ref_name }} + + # Pull latest images + docker-compose pull + + # Restart services + docker-compose down + docker-compose up -d + + # Wait for services to be ready + sleep 30 + + # Test connectivity + curl -f http://localhost:3000/health || exit 1 + curl -f http://localhost:8001/health || exit 1 + + echo "🎉 Deployment successful!" + EOF + + - name: ✅ Deployment successful + run: | + echo "🎉 Application deployed successfully to server!" + echo "🌐 Your app is now accessible at: http://${{ env.SERVER_HOST }}" diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index dfec3cd..047d063 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -9,7 +9,7 @@ on: env: REGISTRY: docker.io - IMAGE_NAME: ${{ github.repository }} + IMAGE_NAME: lasdecoeurdocker/dockezr jobs: build-and-push: