From fbef8d89a92b0698ba2b65b094f8bca4c435f257 Mon Sep 17 00:00:00 2001 From: Daniel Ciesla Date: Sun, 23 Mar 2025 14:22:34 -0300 Subject: [PATCH] Create deploy.yml Git Actions --- .github/workflows/deploy.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..fe7c53f --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,24 @@ +name: Deploy na AWS + +on: + push: + branches: + - homologacao # Altere para a branch desejada + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Configurar SSH + run: | + mkdir -p ~/.ssh + echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/github_actions_key + chmod 600 ~/.ssh/github_actions_key + ssh-keyscan -H ${{ secrets.AWS_HOST }} >> ~/.ssh/known_hosts + + - name: Rodar Docker Compose na Instância + run: | + ssh -i ~/.ssh/github_actions_key ${{ secrets.AWS_USER }}@${{ secrets.AWS_HOST }} << 'EOF' + sudo docker-compose up --build -d + EOF