From e4bcc1eaf6c8fbf32df71a56851ee8bf1deb11c3 Mon Sep 17 00:00:00 2001 From: Stefanie-A Date: Mon, 14 Oct 2024 16:19:32 +0100 Subject: [PATCH] fix: workflow steps --- .github/workflows/deploy.yaml | 38 +++++++++-------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 896c210..17f7dae 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -6,35 +6,15 @@ jobs: Deployment: runs-on: ubuntu-latest steps: - - name: Write SSH key to file - run: | - echo "${{ secrets.EC2_KEY }}" | tr -d '\r' > ~/ec2_key.pem - - - name: Set SSH key permissions - run: chmod 600 ~/ec2_key.pem - - # SSH into the EC2 instance and run your deployment commands + - name: checkout code + uses: actions/checkout@v4 - name: SSH into EC2 and run deployment run: | - ssh -o StrictHostKeyChecking=no -i ~/ec2_key.pem ec2-user@${{ secrets.EC2_HOST }} << 'EOF' - sudo apt update -y - sudo apt install docker.io -y - sudo apt install docker-compose-plugin -y - - docker pull stefnie/api-image:latest - docker pull stefnie/uri-image:latest - - docker-compose -f /path/to/compose.yaml up -d - EOF - # - name: checkout code - # uses: actions/checkout@v4 - # - name: SSH into EC2 and run deployment - # run: | - # ssh -i ${{ secrets.EC2_KEY }} ec2-user@${{ secrets.EC2_HOST }} - # sudo apt update -y - # sudo apt install docker.io -y - # sudo apt install docker-compose-plugin - # docker pull stefnie/api-image:latest - # docker pull stefnie/uri-image:latest - # docker-compose -f compose.yaml up -d + ssh -i ${{ secrets.EC2_KEY }} ec2-user@${{ secrets.EC2_HOST }} + sudo apt update -y + sudo apt install docker.io -y + sudo apt install docker-compose-plugin + docker pull stefnie/api-image:latest + docker pull stefnie/uri-image:latest + docker-compose -f compose.yaml up -d \ No newline at end of file