From 4011866ecac2c039119a9d6e83e068cd244dc4ad Mon Sep 17 00:00:00 2001 From: Franck Date: Tue, 27 Aug 2024 12:25:05 +0100 Subject: [PATCH] Update deploy.yml --- .github/workflows/deploy.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c8f948af9da6b..668eb059b29c4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -14,16 +14,17 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Install SSH Key - uses: shimataro/ssh-key-action@v2 - with: - key: ${{ secrets.SSH_PRIVATE_KEY }} - known_hosts: ${{ secrets.SSH_HOST }} + - name: Set up SSH key + run: | + mkdir -p ~/.ssh + echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa + chmod 600 ~/.ssh/id_rsa + ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts - - name: Deploy to Server + - name: Deploy to Server and Run Migrations run: | - ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd ${{ secrets.PATH_DIR }} && git pull ${{ secrets.MAIN_BRANCH }}" + ssh -i ~/.ssh/id_rsa ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd ${{ secrets.WORK_DIR }} && git pull origin ${{ secrets.MAIN_BRANCH }}" - name: Cleanup if: always() - run: rm -rf ~/.ssh \ No newline at end of file + run: rm -rf ~/.ssh