diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index 2eda890..abc84f8 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -1,45 +1,45 @@ -# # CD Backend - -# name: CD BE - -# on: -# push: -# branches: -# - main -# jobs: -# build_push_docker: -# name: Build Backend For Prod files and push to docker -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v2 - -# - name: Build Backend For Prod files -# run: | -# docker build -t aoudaa/dkr-backend:latest . - -# - name: Login to Docker Hub -# uses: docker/login-action@v2 -# with: -# username: ${{ secrets.DOCKER_USERNAME }} -# password: ${{ secrets.DOCKER_PASSWORD }} - -# - name: Push Docker Backend image - -# run: | -# docker push aoudaa/dkr-backend:latest - -# deploy: -# name: Deploy Backend For Prod files -# runs-on: ubuntu-latest -# needs: build_push_docker - -# steps: -# - name: ssh into vm and run the script -# uses: appleboy/ssh-action@master -# with: -# host: ${{ secrets.HOST }} -# username: ${{ secrets.USERNAME }} -# key: ${{ secrets.SSH_KEY }} -# script: | -# cd ~/docker -# sh deployBE.sh +# CD Backend + +name: CD BE + +on: + push: + branches: + - main +jobs: + build_push_docker: + name: Build Backend For Prod files and push to docker + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Build Backend For Prod files + run: | + docker build -t aoudaa/dkr-backend:latest . + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Push Docker Backend image + + run: | + docker push aoudaa/dkr-backend:latest + + deploy: + name: Deploy Backend For Prod files + runs-on: ubuntu-latest + needs: build_push_docker + + steps: + - name: ssh into vm and run the script + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.SSH_KEY }} + script: | + cd ~/docker + sh deployBE.sh diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index e9d578f..deb3d02 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -3,13 +3,9 @@ name: CI BE on: - push: - branches: - - main pull_request: branches: - main - jobs: build_dev_test: name: Build Backend For Dev files