I am deploying my app with Github not able to get the package path right

Schwartz, Matt 0 Reputation points
2024-03-08T11:22:21.6333333+00:00

I am trying to manage my wp-content folder of the site with the GitHub repo I have generated .yml file but I am not able to get the package path right so I can target wp-content folder of my. Below is my .yml file

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 - webapp-msfwex01-23-exportacigarettes-qa

on:
  push:

branches:
  - staging

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 }}

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: 'Deploy to Azure Web App'
    uses: azure/webapps-deploy@v2
    id: deploy-to-webapp
    with:
      app-name: 'webapp-msfwex01-23-exportacigarettes-qa'
      slot-name: 'production'
      package: /site/wwwroot/wp-content/
      publish-profile: ${{ secrets.AzureAppService_PublishProfile_f1eda9c01c9b4e39b9e89ab51811caff }}  

Getting this error

deployDeployment Failed, Error: No package found with specified pattern: /site/wwwroot/wp-content/**deploy**Deployment Failed, Error: No package found with specified pattern: /site/wwwroot/wp-content/

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,930 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 30,281 Reputation points Microsoft Employee Moderator
    2024-03-11T22:24:08.1+00:00

    Hey @Schwartz, Matt

    It's tough to say what could've led up to that error. In reviewing your yaml file, I'm personally pointing the finger that the zip unzip that is done between the build and deployment steps. Without seeing more of the deployment log, my assumption is the files may not have been unzipped as expected. The startup command Linux hosts is /home/site/startup.sh and this bash script will look for your php app in /home/site/wwwroot.

    Having said, you don't necessarily need to zip and unzip your artifacts. On the build, the last step can be

          - name: Upload artifact for deployment job
            uses: actions/upload-artifact@v2
            with:
              name: php-app
              path: .
    

    and the on the deploy side,

       steps:
          - name: Download artifact from build job
            uses: actions/download-artifact@v2
            with:
              name: php-app
    
          - name: 'Deploy to Azure Web App'
            uses: azure/webapps-deploy@v2
            id: deploy-to-webapp
            with:
              app-name: 'yourappservicename'
              slot-name: 'production'
              publish-profile: $
              package: .
    

    You can refer to https://azureossd.github.io/2022/04/22/PHP-Laravel-deploy-on-App-Service-Linux/index.html for a complete reference as well as additional configuration information.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.