S_R
S_R

Reputation: 11

Azure App Service Deployment: Unable to Find Artifacts in GitHub Actions Workflow

I am encountering an issue while attempting to deploy a Spring Boot application to Azure App Service using GitHub Actions. The build process on GitHub is successful; however, the deployment step is failing with the following error message: "Error: Unable to find any artifacts for the associated workflow."

GitHub Actions Workflow Configuration:

# 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 WAR app to Azure Web App - webApp12dg

on:
  push:
    branches:
      - main
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Set up Java version
        uses: actions/setup-java@v1
        with:
          java-version: '17'

      - name: Build with Maven
        run: mvn clean install

      - name: Upload artifact for deployment job
        uses: actions/upload-artifact@v3
        with:
          name: java-app
          path: '${{ github.workspace }}/target/*.war'

  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: java-app

      - name: Deploy to Azure Web App
        id: deploy-to-webapp
        uses: azure/webapps-deploy@v2
        with:
          app-name: 'webApp12dg'
          slot-name: 'Production'
          publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_F2A6B2A7E43B4D568F7E92A0E5D97521 }}
          package: '*.war'

added error trace image in the github

Upvotes: 1

Views: 391

Answers (1)

Aslesha Kantamsetti
Aslesha Kantamsetti

Reputation: 1526

I tried a simple Java Spring Boot application and successfully deployed it to Azure App Service via GitHub.

For deployment purposes, I ran the following command.

mvn clean install

Local output:

enter image description here

Workflow Configuration :

name: Build and deploy WAR app to Azure Web App - kajava123
on:
  push:
    branches:
      - main
  workflow_dispatch:
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Set up Java version
        uses: actions/setup-java@v1
        with:
          java-version: '17'
      - name: Build with Maven
        run: mvn clean install

      - name: Upload artifact for deployment job
        uses: actions/upload-artifact@v3
        with:
          name: java-app
          path: '${{ github.workspace }}/target/*.war'
  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: java-app
            - name: Deploy to Azure Web App
        id: deploy-to-webapp
        uses: azure/webapps-deploy@v2
        with:
          app-name: 'kajava123'
          slot-name: 'Production'
          package: '*.war'
          publish-profile: ${{ secrets.AZUREAPPSERVICE_PUBLISHPROFILE_Key }}

Ensure that the Build Success response is present after running the build with Maven, as shown below:

enter image description here

In the build run, ensure that artifacts are successfully uploaded, as shown below: enter image description here

I downloaded the artifact without any errors. enter image description here

Azure web app Output enter image description here

Upvotes: 0

Related Questions