From ae1c754b1d40023a04d5aad7893809aef9d73a72 Mon Sep 17 00:00:00 2001 From: Lukas Date: Fri, 15 Mar 2024 20:12:39 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7:=20Added=20CI=20for=20main?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy-backend-prod.yml | 53 +++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/deploy-backend-prod.yml diff --git a/.github/workflows/deploy-backend-prod.yml b/.github/workflows/deploy-backend-prod.yml new file mode 100644 index 0000000..bd77539 --- /dev/null +++ b/.github/workflows/deploy-backend-prod.yml @@ -0,0 +1,53 @@ +name: Upload backend to PROD server and lint + +on: + push: + branches: + - prod + +env: + FLUTTER_VERSION: 3.10.1 + +jobs: + deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install SSH key + uses: webfactory/ssh-agent@v0.5.3 + with: + ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} + + - name: Upload PHP code + run: scp -o StrictHostKeyChecking=no -r backend ${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_HOST }}:/home/imjames/www/API-3IL/prod + + install_dependencies: + needs: deploy + runs-on: ubuntu-latest + + steps: + - name: SSH Into Server and Install Composer Dependencies + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_USERNAME }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + script: | + cd /home/imjames/www/API-3IL/prod/backend + composer2 install + + - name: SSH Into Server and execute Linter for PHP + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.SERVER_HOST }} + username: ${{ secrets.SERVER_USERNAME }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + script: | + cd /home/imjames/www/API-3IL/prod/backend + vendor/bin/php-cs-fixer fix src + + + \ No newline at end of file