From c760e44f6e634613ca3a39ad31a5088fb8174de5 Mon Sep 17 00:00:00 2001 From: ti-igari <166084995+ti-igari@users.noreply.github.com> Date: Fri, 5 Apr 2024 11:54:14 +0900 Subject: [PATCH 1/4] Add or update the Azure App Service build and deployment workflow config --- .../workflows/master_20240406-igari-test.yml | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 .github/workflows/master_20240406-igari-test.yml diff --git a/.github/workflows/master_20240406-igari-test.yml b/.github/workflows/master_20240406-igari-test.yml new file mode 100644 index 000000000..3febe1900 --- /dev/null +++ b/.github/workflows/master_20240406-igari-test.yml @@ -0,0 +1,75 @@ +# Docs for the Azure Web Apps Deploy action: https://github.com/Azure/webapps-deploy +# More GitHub Actions for Azure: https://github.com/Azure/actions + +name: Build and deploy PHP app to Azure Web App - 20240406-igari-test + +on: + push: + branches: + - master + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + + - name: Check if composer.json exists + id: check_files + uses: andstor/file-existence-action@v1 + with: + 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@v3 + with: + name: php-app + path: release.zip + + deploy: + runs-on: ubuntu-latest + needs: build + environment: + name: 'Production' + url: ${{ steps.deploy-to-webapp.outputs.webapp-url }} + permissions: + id-token: write #This is required for requesting the JWT + + steps: + - name: Download artifact from build job + uses: actions/download-artifact@v3 + with: + name: php-app + + - name: Unzip artifact for deployment + run: unzip release.zip + + - name: Login to Azure + uses: azure/login@v1 + with: + client-id: ${{ secrets.AZUREAPPSERVICE_CLIENTID_C43B3EC60FAD4B09B94A2CD0AC655C25 }} + tenant-id: ${{ secrets.AZUREAPPSERVICE_TENANTID_76857F9A86E644EE8F7C9013423F2C19 }} + subscription-id: ${{ secrets.AZUREAPPSERVICE_SUBSCRIPTIONID_B84F6D04F9FE4E74B507216B034EA183 }} + + - name: 'Deploy to Azure Web App' + uses: azure/webapps-deploy@v2 + id: deploy-to-webapp + with: + app-name: '20240406-igari-test' + slot-name: 'Production' + package: . + \ No newline at end of file From 853a872c9318b6eba1c609499b2adc9c99d60139 Mon Sep 17 00:00:00 2001 From: ti-igari <166084995+ti-igari@users.noreply.github.com> Date: Fri, 5 Apr 2024 14:21:13 +0900 Subject: [PATCH 2/4] Update index.php --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index 82966e27a..99a5c1b87 100644 --- a/index.php +++ b/index.php @@ -1,3 +1,3 @@ Date: Fri, 5 Apr 2024 14:32:33 +0900 Subject: [PATCH 3/4] Update index.php --- index.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.php b/index.php index 99a5c1b87..ae2a245f2 100644 --- a/index.php +++ b/index.php @@ -1,3 +1,7 @@ Date: Fri, 5 Apr 2024 15:06:48 +0900 Subject: [PATCH 4/4] Update index.php --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index ae2a245f2..01a65bf6a 100644 --- a/index.php +++ b/index.php @@ -3,5 +3,5 @@ echo "Hello Azure"; $stdout = fopen('php://stdout', 'a'); -fwrite($stdout, "piyo"); +fwrite($stdout, "アクセスしました。"); fclose($stdout);