Skip to content

Commit

Permalink
chore: reverting chenges in deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusdoedev committed Sep 28, 2023
1 parent aa2de8e commit a1a1546
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,14 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Creating a private key
run: |
mkdir ~/.ssh
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa
chmod 400 ~/.ssh/id_rsa
- name: Acessing EC2 instance
run: |
sudo apt update
sudo apt install ssh
sudo ssh -i ~/.ssh/id_rsa ${{ secrets.AWS_EC2_USERNAME }}@${{ secrets.AWS_EC2_HOST }}
- name: Pulling docker image
run: sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ env.CONTAINER_NAME }}

- name: Running container
run: sudo docker run -d -p 80:80 ${{ secrets.DOCKER_USERNAME }}/${{ env.CONTAINER_NAME }}
- name: SSH Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.AWS_EC2_HOST }}
username: ${{ secrets.AWS_EC2_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
sudo docker pull ${{ secrets.DOCKER_USERNAME }}/${{ env.CONTAINER_NAME }}
sudo docker stop ${{ secrets.DOCKER_USERNAME }}/${{ env.CONTAINER_NAME }}
sudo docker rm ${{ secrets.DOCKER_USERNAME }}/${{ env.CONTAINER_NAME }}
sudo docker run -d -p 80:80 ${{ secrets.DOCKER_USERNAME }}/${{ env.CONTAINER_NAME }}

0 comments on commit a1a1546

Please sign in to comment.