From bc315ba856ffc543cd2565f37446c2167e99bbd2 Mon Sep 17 00:00:00 2001 From: Ravencodess <115118888+Ravencodess@users.noreply.github.com> Date: Thu, 15 Aug 2024 15:27:04 +0100 Subject: [PATCH] Update anchor-deploy.yaml Signed-off-by: Ravencodess <115118888+Ravencodess@users.noreply.github.com> --- .github/workflows/anchor-deploy.yaml | 58 ++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 7 deletions(-) diff --git a/.github/workflows/anchor-deploy.yaml b/.github/workflows/anchor-deploy.yaml index 490435f49..40ef30d1f 100644 --- a/.github/workflows/anchor-deploy.yaml +++ b/.github/workflows/anchor-deploy.yaml @@ -7,7 +7,7 @@ on: - completed jobs: - deploy_to_dev: + deploy_to_java: if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest @@ -31,8 +31,8 @@ jobs: - name: Copy Artifacts to server run: | sudo apt update && sudo apt install sshpass -y - sshpass -p ${{ secrets.PASSWORD }} scp -o StrictHostKeyChecking=no boilerplate.tar.gz .env.java ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/tmp/ - rm -f boilerplate.tar.gz .env + sshpass -p ${{ secrets.PASSWORD }} scp -o StrictHostKeyChecking=no boilerplate.tar.gz .env.java ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/tmp/java + rm -f boilerplate.tar.gz .env.java - name: Deploy on server uses: appleboy/ssh-action@master @@ -41,9 +41,53 @@ jobs: username: ${{ secrets.USERNAME }} password: ${{ secrets.PASSWORD }} script: | - cd boilerplate + cd boilerplate-frontend rm -rf * - tar -xzf /tmp/boilerplate.tar.gz - mv /tmp/.env.java .env - rm -f /tmp/boilerplate.tar.gz + tar -xzf /tmp/java/boilerplate.tar.gz + mv /tmp/java/.env.java .env + rm -f /tmp/java/boilerplate.tar.gz cp -r .next/standalone/* . + pm2 restart java-boilerplate --update-env + + + deploy_to_python: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + + environment: + name: "anchor-python" + url: ${{ vars.URL }} + + steps: + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} + name: boilerplate-build + path: . + + - name: Decode and create .env file + run: | + echo ${{ secrets.ENV }} | base64 -d > .env.python + + - name: Copy Artifacts to server + run: | + sudo apt update && sudo apt install sshpass -y + sshpass -p ${{ secrets.PASSWORD }} scp -o StrictHostKeyChecking=no boilerplate.tar.gz .env.python ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/tmp/python + rm -f boilerplate.tar.gz .env.python + + - name: Deploy on server + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + script: | + cd boilerplate-frontend + rm -rf * + tar -xzf /tmp/python/boilerplate.tar.gz + mv /tmp/python/.env.java .env + rm -f /tmp/python/boilerplate.tar.gz + cp -r .next/standalone/* . + pm2 restart python-boilerplate --update-env