From 2d655fc79757f371755b9d76ba3c64ce0edb18db Mon Sep 17 00:00:00 2001 From: rishabh Date: Mon, 14 Jul 2025 13:30:43 +0530 Subject: [PATCH] updated main.yml --- .github/workflows/develop.yml | 32 ---------------------------- .github/workflows/main.yml | 39 +++++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 48 deletions(-) delete mode 100644 .github/workflows/develop.yml diff --git a/.github/workflows/develop.yml b/.github/workflows/develop.yml deleted file mode 100644 index b8fabdb..0000000 --- a/.github/workflows/develop.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Deploy on staging - -on: - push: - branches: - - develop - pull_request: - types: [closed] - branches: - - develop - -jobs: - build: - name: "Fetching and restarting admin subdomain" - runs-on: ubuntu-latest - - steps: - - name: Execute commands via SSH - uses: appleboy/ssh-action@master - with: - host: 43.205.81.36 - username: "oh" - key: ${{ secrets.EC2_KEY }} - script: | - echo "Deploying to EC2" - cd /home/frappe/frappe-bench/apps/clientside - git add . - git stash - git pull - bench --site app.onehash.is migrate - echo ${{secrets.EC2_PROD_PW}} | sudo -S supervisorctl restart all - echo ${{secrets.EC2_PROD_PW}} | sudo -S bench setup production frappe --yes diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9ed7595..33b5960 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,34 +1,41 @@ -name: Deploy on production +name: Deploy clientside to EC2 on: - push: - branches: - - main pull_request: types: [closed] branches: - - main + - v-15 jobs: build: - name: "Fetching and restarting admin subdomain" + name: "Fetching and restarting supervisorctl" runs-on: ubuntu-latest steps: + - name: Checkout Code + uses: actions/checkout@v3 + - name: Execute commands via SSH - uses: appleboy/ssh-action@master + uses: appleboy/ssh-action@v1.0.0 with: - host: 43.205.81.36 - username: "oh" + host: ${{ secrets.EC2_IP }} + username: onehash key: ${{ secrets.EC2_KEY }} script: | - echo "Deploying to EC2" - cd /home/oh/frappe-bench/apps/clientside - git add . + echo "🔄 Deploying clientside to EC2..." + cd /home/onehash/frappe-bench/apps/clientside + + echo "📦 Stashing any local changes..." git stash - git pull - bench --site app.onehash.is migrate - echo ${{secrets.EC2_PROD_PW}} | sudo -S supervisorctl restart all - echo ${{secrets.EC2_PROD_PW}} | sudo -S bench setup production oh --yes + + echo "⬇️ Pulling latest code from v-15 branch..." + git checkout v-15 + git pull upstream v-15 + + echo "⚙️ Building clientside app..." + bench build --app clientside + + echo "🚀 Restarting supervisor services..." + echo ${{secrets.EC2_PW}} | sudo -S supervisorctl restart all