From 7f1724db1b3c708fe872526118aa945898ecb1fe Mon Sep 17 00:00:00 2001 From: ibrahim Date: Thu, 15 Aug 2024 13:10:11 -0700 Subject: [PATCH 1/2] Create bulldozer-php-deployment.yml Signed-off-by: ibrahim --- .../workflows/bulldozer-php-deployment.yml | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/bulldozer-php-deployment.yml diff --git a/.github/workflows/bulldozer-php-deployment.yml b/.github/workflows/bulldozer-php-deployment.yml new file mode 100644 index 000000000..367563e49 --- /dev/null +++ b/.github/workflows/bulldozer-php-deployment.yml @@ -0,0 +1,58 @@ +name: Bulldozer PHP Deployment + +on: + workflow_dispatch: + workflow_run: + workflows: ["Build and Upload"] + types: + - completed + +jobs: + deploy_boilerplate_frontend: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + + environment: + name: "bulldozer-php" + url: ${{ vars.URL }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - 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: Create .env + uses: vicradon/create-env-action@v1.0.1 + with: + action_input_file: ".env.sample" + action_output_file: ".env" + API_URL: ${{ vars.API_URL }} + NEXTAUTH_URL: ${{ vars.URL }} + + - name: Copy Artifacts to server + uses: appleboy/scp-action@v0.1.7 + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + source: ".env,boilerplate.tar.gz" + target: "~/var/www/boilerplate_fe/dev" + + - name: Deploy on server + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.HOST }} + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + script: | + cd ~/var/www/boilerplate_fe/dev + tar -xzf boilerplate.tar.gz + rm -f boilerplate.tar.gz + pm2 restart boilerplate-frontend --update-env From 969e3d951542c7e7b51a9980ec6cadf1bcea73cc Mon Sep 17 00:00:00 2001 From: David Olayemi <38155220+Olat-nji@users.noreply.github.com> Date: Thu, 15 Aug 2024 23:43:59 +0100 Subject: [PATCH 2/2] fix: fixed directories in bulldozer-php-deployment.yml Signed-off-by: David Olayemi <38155220+Olat-nji@users.noreply.github.com> --- .github/workflows/bulldozer-php-deployment.yml | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/.github/workflows/bulldozer-php-deployment.yml b/.github/workflows/bulldozer-php-deployment.yml index 367563e49..fc5d233ce 100644 --- a/.github/workflows/bulldozer-php-deployment.yml +++ b/.github/workflows/bulldozer-php-deployment.yml @@ -28,13 +28,6 @@ jobs: name: boilerplate-build path: . - - name: Create .env - uses: vicradon/create-env-action@v1.0.1 - with: - action_input_file: ".env.sample" - action_output_file: ".env" - API_URL: ${{ vars.API_URL }} - NEXTAUTH_URL: ${{ vars.URL }} - name: Copy Artifacts to server uses: appleboy/scp-action@v0.1.7 @@ -42,8 +35,8 @@ jobs: host: ${{ secrets.HOST }} username: ${{ secrets.USERNAME }} password: ${{ secrets.PASSWORD }} - source: ".env,boilerplate.tar.gz" - target: "~/var/www/boilerplate_fe/dev" + source: "boilerplate.tar.gz" + target: "/var/www/boilerplate_fe/dev" - name: Deploy on server uses: appleboy/ssh-action@master @@ -52,7 +45,9 @@ jobs: username: ${{ secrets.USERNAME }} password: ${{ secrets.PASSWORD }} script: | - cd ~/var/www/boilerplate_fe/dev + cd /var/www/boilerplate_fe/dev + rm -rf .next + rm -rf public tar -xzf boilerplate.tar.gz rm -f boilerplate.tar.gz pm2 restart boilerplate-frontend --update-env