From 1cd522cfe10dcd319e487c56a787c11974d3988f Mon Sep 17 00:00:00 2001 From: amgno Date: Mon, 23 Sep 2024 12:45:13 +0200 Subject: [PATCH] ar --- .github/workflows/main2.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/main2.yml b/.github/workflows/main2.yml index 8dd9d4c..a2e5da4 100644 --- a/.github/workflows/main2.yml +++ b/.github/workflows/main2.yml @@ -8,19 +8,21 @@ jobs: steps: - name: Access to Server, Remove Docker Containers, Build Docker Image, Run Docker Container run: | - sshpass -p ${{ secrets.PASSWORD }} ssh -o StrictHostKeyChecking=no ${{ secrets.USER_NAME }}@${{ secrets.SERVER_ADDRESS }} -p ${{ secrets.SSH_PORT }} + sshpass -p ${{ secrets.PASSWORD }} ssh -o StrictHostKeyChecking=no ${{ secrets.USER_NAME }}@${{ secrets.SERVER_ADDRESS }} -p ${{ secrets.SSH_PORT }} << 'EOF' echo ✅ SSH connection successful && ls && echo ✅ Listing directory && echo wow && - if [ -d "/home/deployer/amgno.github.io" ]; then - cd /home/deployer/amgno.github.io && - echo ✅ Pulling from GitHub && - git pull && - echo ✅ Starting docker && - docker-compose down && - docker-compose up -d && - echo ✅ Done - else - echo ❌ Directory /home/deployer/amgno.github.io does not exist - fi + if [ ! -d "/home/deployer/amgno.github.io" ]; then + echo ❌ Directory /home/deployer/amgno.github.io does not exist, creating it && + mkdir -p /home/deployer/amgno.github.io && + echo ✅ Directory created + fi && + cd /home/deployer/amgno.github.io && + echo ✅ Pulling from GitHub && + git pull && + echo ✅ Starting docker && + docker-compose down && + docker-compose up -d && + echo ✅ Done + EOF