Skip to content

Merge pull request #40 from SoftBananas/ci-cd #26

Merge pull request #40 from SoftBananas/ci-cd

Merge pull request #40 from SoftBananas/ci-cd #26

Workflow file for this run

name: Deploy
on:
push:
branches: [ main-banana ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Log in to Docker Hub
uses: docker/login-action@v3.0.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
run: |
touch .env.prod
echo "${{ secrets.ENV }}" > .env.prod
docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml push
- name: SSH into server and deploy
run: |
sshpass -p ${{ secrets.SERVER_PASSWORD }} ssh -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