update runner

This commit is contained in:
Puechberty Arthur
2026-06-11 01:06:48 +02:00
parent f0c7de95de
commit 5679ea30d2
4 changed files with 68 additions and 43 deletions
+14 -29
View File
@@ -1,42 +1,27 @@
name: Deploy to VM Prod
name: Deploy Docker
on:
push:
branches:
- main
branches: ["main"]
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Deploy to production
- name: Deploy on server
run: |
REPO_NAME=${{ github.event.repository.name }}
set -e
if [ -z "${{ secrets.ENV_FILE }}" ]; then
ENV_CONTENT=""
else
ENV_CONTENT="${{ secrets.ENV_FILE }}"
fi
echo "Go to app folder"
cd /opt/apps/links
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "
mkdir -p /srv/$REPO_NAME
cd /srv/$REPO_NAME
echo "Pull latest code"
git pull origin main
if [ ! -d .git ]; then
rm -rf ./* # vide le dossier si nécessaire
git clone https://github.com/arthur-pbty-labs/$REPO_NAME .
else
git reset --hard
git pull origin main
fi
echo "Build & restart containers"
docker compose down || true
docker compose build
docker compose up -d
if [ -n \"$ENV_CONTENT\" ]; then
echo \"$ENV_CONTENT\" > .env
fi
docker compose up -d --build
"
echo "Deploy finished"