Skip to content

Commit

Permalink
modifying file
Browse files Browse the repository at this point in the history
  • Loading branch information
p-shubh committed May 31, 2024
1 parent 0982bc0 commit 4d53632
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main
- frontend
- backend

jobs:
Deploy:
Expand All @@ -21,7 +21,7 @@ jobs:
password: ${{ secrets.GHCR_TOKEN }}

- name: Build and Push Backend Docker Image
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/backend'
run: |
export CURRENT_BRANCH=${GITHUB_REF#refs/heads/}
export TAG=$([[ $CURRENT_BRANCH == $(basename ${{ github.ref }}) ]] && echo $CURRENT_BRANCH || echo "latest")
Expand All @@ -33,7 +33,7 @@ jobs:
docker push $GITHUB_BRANCH_IMAGE
- name: Build and Push for Frontend server
if: github.ref == 'refs/heads/frontend'
if: github.ref == 'refs/heads/main'
env:
PROD_ENV_FILE: ${{ secrets.ENV_FILE }}
run: |
Expand All @@ -52,7 +52,7 @@ jobs:
rm -rf .env
- name: Deploy on DEV server
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/backend'
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEV_REMOTE_SERVER_ADDRESS }}
Expand All @@ -62,12 +62,12 @@ jobs:
script: |
pwd
cd sui_backend
sudo docker stop sui_backend && sudo docker rm sui_backend && sudo docker image rm ghcr.io/p-shubh/sui_overflow_hack:main
sudo docker stop sui_backend && sudo docker rm sui_backend && sudo docker image rm ghcr.io/p-shubh/sui_overflow_hack:backend
echo ${{ secrets.GHCR_TOKEN }} | sudo docker login ghcr.io -u secrets.GHCR_USERNAME --password-stdin
sudo docker pull ghcr.io/p-shubh/sui_overflow_hack:main
sudo docker run --name="sui_backend" --env-file=.env -p 8181:6060 --net=bridge -d ghcr.io/p-shubh/sui_overflow_hack:main
sudo docker pull ghcr.io/p-shubh/sui_overflow_hack:backend
sudo docker run --name="sui_backend" --env-file=.env -p 8181:6060 --net=bridge -d ghcr.io/p-shubh/sui_overflow_hack:backend
- name: Deploy on Frontend server
if: github.ref == 'refs/heads/frontend'
if: github.ref == 'refs/heads/main'
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEV_REMOTE_SERVER_ADDRESS }}
Expand All @@ -76,7 +76,7 @@ jobs:
port: ${{ secrets.DEV_SSH_PORT }}
script: |
pwd
sudo docker stop sui-frontend || true && sudo docker image rm ghcr.io/p-shubh/sui_overflow_hack:frontend
sudo docker stop sui-frontend || true && sudo docker image rm ghcr.io/p-shubh/sui_overflow_hack:main
echo ${{ secrets.GHCR_TOKEN }} | sudo docker login ghcr.io -u ${{ secrets.GHCR_USERNAME }} --password-stdin
sudo docker pull ghcr.io/p-shubh/sui_overflow_hack:frontend
sudo docker run --name="sui-frontend" --rm -p 4040:6060 --net=bridge -d ghcr.io/p-shubh/sui_overflow_hack:frontend
sudo docker pull ghcr.io/p-shubh/sui_overflow_hack:main
sudo docker run --name="sui-frontend" --rm -p 4040:6060 --net=bridge -d ghcr.io/p-shubh/sui_overflow_hack:main

0 comments on commit 4d53632

Please sign in to comment.