Skip to content

Commit

Permalink
Merge pull request #46 from SoftBananas/ci-cd
Browse files Browse the repository at this point in the history
fix: deploy.yml
  • Loading branch information
ONEPANTSU authored Mar 5, 2024
2 parents 0008628 + c223439 commit 1e8ed79
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ jobs:
docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml push
- name: SSH into server and deploy
- name: Checkout repository
uses: actions/checkout@v2

- name: Install sshpass
run: sudo apt-get install -y sshpass

- name: Copy docker-compose.yml to server
run: scp -P ${{ secrets.SERVER_PORT }} docker-compose.yml ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_HOST }}:/home/ivan/teamapp/docker-compose.yml

- name: Deploy to server
run: |
sshpass -p ${{ secrets.SERVER_PASSWORD }} ssh -tt -p ${{ secrets.SERVER_PORT }} ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_HOST }} 'cd /home/ivan && (cd teamapp || (cd mkdir teamapp && cd teamapp && git clone https://github.com/SoftBananas/teamapp-backend.git && git pull)) && cd teamapp && touch .env.prod && echo "${{ secrets.ENV }}" > .env.prod && docker-compose -f docker-compose.yml down && docker-compose -f docker-compose.yml up -d'
sshpass -p ${{ secrets.SERVER_PASSWORD }} ssh -p ${{ secrets.SERVER_PORT }} ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_HOST }} "cd /home/ivan/teamapp/ && docker-compose up -d"

0 comments on commit 1e8ed79

Please sign in to comment.