From 74cd84a6435540e468738798e73b821e29948743 Mon Sep 17 00:00:00 2001 From: Yuta Matsumura Date: Sun, 26 May 2024 14:31:54 +0900 Subject: [PATCH] update simple php workflow --- .github/workflows/php-simple.yml | 36 +++++++++++++------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/.github/workflows/php-simple.yml b/.github/workflows/php-simple.yml index 3e91c72..69227a9 100644 --- a/.github/workflows/php-simple.yml +++ b/.github/workflows/php-simple.yml @@ -9,7 +9,7 @@ on: workflow_dispatch: env: - PHP_VERSION: '8.x' + PHP_VERSION: '8.2' WORKING_DIRECTORY: php/simple permissions: @@ -28,40 +28,28 @@ jobs: - uses: actions/checkout@v4 - name: Setup PHP - uses: shivammathur/setup-php@7c0b4c8c8ebed23eca9ec2802474895d105b11bc + uses: shivammathur/setup-php@v2 with: php-version: ${{ env.PHP_VERSION }} - name: Check if composer.json exists id: check_files - uses: andstor/file-existence-action@87d74d4732ddb824259d80c8a508c0124bf1c673 + uses: andstor/file-existence-action@v1 with: - files: '${{ env.WORKING_DIRECTORY }}/composer.json' - - - name: Get Composer Cache Directory - id: composer-cache - if: steps.check_files.outputs.files_exists == 'true' - run: | - echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: Set up dependency caching for faster installs - uses: actions/cache@v2 - if: steps.check_files.outputs.files_exists == 'true' - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- + files: 'composer.json' - name: Run composer install if composer.json exists if: steps.check_files.outputs.files_exists == 'true' run: composer validate --no-check-publish && composer install --prefer-dist --no-progress + - name: Zip artifact for deployment + run: zip release.zip ./* -r + - name: Upload artifact for deployment job - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: php-app - path: ${{ env.WORKING_DIRECTORY }} + path: release.zip deploy-php: runs-on: ubuntu-latest @@ -71,10 +59,13 @@ jobs: url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} steps: - name: Download artifact from build job - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: php-app + - name: Unzip artifact for deployment + run: unzip release.zip + - name: Az CLI Login uses: azure/login@v2 with: @@ -95,6 +86,7 @@ jobs: with: app-name: ${{ vars.AZURE_WEBAPP_NAME }}-php slot-name: 'Production' + package: . - name: Az CLI Logout run: az logout