-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ on: | |
push: | ||
branches: | ||
- main | ||
- frontend | ||
- backend | ||
|
||
jobs: | ||
Deploy: | ||
|
@@ -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") | ||
|
@@ -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: | | ||
|
@@ -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 }} | ||
|
@@ -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 }} | ||
|
@@ -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 |