diff --git a/.github/workflows/be-autodeploy.yml b/.github/workflows/be-autodeploy.yml index 440972f..8b7ce4b 100644 --- a/.github/workflows/be-autodeploy.yml +++ b/.github/workflows/be-autodeploy.yml @@ -54,25 +54,15 @@ jobs: needs: push_to_registry runs-on: ubuntu-latest steps: - - name: Set up SSH - run: | - ls -la ~ - mkdir -v -p ~/.ssh - echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa - echo "SSH key write status: $?" - chmod 600 ~/.ssh/id_rsa - echo "chmod status: $?" - ls -la ~/.ssh - ssh-keyscan -H ${{ secrets.DEV_HOST }} >> ~/.ssh/known_hosts - echo "ssh-keyscan status: $?" - ls -la ~/.ssh - - - name: SSH Connection to EC2 Instance - run: | - ssh -o "StrictHostKeyChecking=no" ${{ secrets.DEV_USERNAME }}@${{ secrets.DEV_HOST }} 'echo "Connected to EC2 Instance"' + - name: connect ssh to WAS server + uses: appleboy/ssh-action@master + with: + key: ${{ secrets.SSH_PRIVATE_KEY }} + host: ${{ secrets.DEV_HOST }} + username: ${{ secrets.DEV_USERNAME }} + script : | docker pull ${{ secrets.NCP_CONTAINER_REGISTRY }}/nibobnebob docker stop my_was_container docker rm my_was_container docker run -d -p 8000:8000 -e API_KEY=${{ secrets.DEV_APIKEY }} --name my_was_container --network mynetwork ${{ secrets.NCP_CONTAINER_REGISTRY }}/nibobnebob docker image prune -f -