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