diff --git a/.github/workflows/deploy-gcp.yml b/.github/workflows/deploy-gcp.yml new file mode 100644 index 0000000..c8b47f5 --- /dev/null +++ b/.github/workflows/deploy-gcp.yml @@ -0,0 +1,62 @@ +name: Build and Deploy +# on: +# push: +# branches: +# - main +on: + pull_request: + types: [opened, synchronize, reopened] + +concurrency: + group: prod-deploy + cancel-in-progress: true + +jobs: + deploy: + runs-on: ubuntu-latest + environment: production + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + coverage: none + + - name: Install dependencies + uses: ramsey/composer-install@v2 + + - name: Install Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + cache: 'npm' + + - name: Install npm dependencies + run: npm ci + + - name: Build assets + run: npm run build + + - name: Zip up the application + run: zip -r application.zip . -x "*.git*" -x "*.github*" + + - name: Upload Application Artifact + uses: actions/upload-artifact@v4 + with: + name: application + path: application.zip + + - name: Place SSH Key + run: echo "${{ secrets.SERVER_SSH_KEY }}" > ./id_rsa && chmod 600 ./id_rsa + + - name: Transfer Zip to Server + run: | + TIMESTAMP=$(date +'%Y%m%d%H%M%S') + SERVER="${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }}" + scp -i ./id_rsa application.zip $SERVER:/tmp/application.zip + ssh -i ./id_rsa $SERVER "unzip /tmp/application.zip -d /var/www/choremanager/releases/$TIMESTAMP" + ssh -i ./id_rsa $SERVER "ln -sf /var/www/choremanager/releases/$TIMESTAMP /var/www/choremanager/current" diff --git a/.github/workflows/fix.yml b/.github/workflows/fix.yml index c94cb0b..5ecc535 100644 --- a/.github/workflows/fix.yml +++ b/.github/workflows/fix.yml @@ -1,7 +1,7 @@ name: Fix Code Style -on: - pull_request: - types: [ opened, synchronize, reopened, ready_for_review ] +# on: +# pull_request: +# types: [ opened, synchronize, reopened, ready_for_review ] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/qc.yml b/.github/workflows/qc.yml index 7826d69..d6a7597 100644 --- a/.github/workflows/qc.yml +++ b/.github/workflows/qc.yml @@ -1,11 +1,11 @@ name: QC run-name: 'QC (PR #${{ github.event.pull_request.number }})' -on: - pull_request: - types: [opened, synchronize, reopened] - workflow_call: - workflow_dispatch: +# on: +# pull_request: +# types: [opened, synchronize, reopened] +# workflow_call: +# workflow_dispatch: concurrency: group: qc-${{ github.event.pull_request.number }}