Proposed Pull Request Change

author ms.author ms.topic ms.date ms.service
cephalin cephalin include 01/16/2025 azure-app-service
📄 Document Links
GitHub View on GitHub Microsoft Learn View on Microsoft Learn
Raw New Markdown
Generating updated version of doc...
Rendered New Markdown
Generating updated version of doc...
+0 -0
+0 -0
--- author: cephalin ms.author: cephalin ms.topic: include ms.date: 01/16/2025 ms.service: azure-app-service --- The `publish-profile` input should reference the `AZURE_WEBAPP_PUBLISH_PROFILE` GitHub secret that you created earlier. # [ASP.NET Core](#tab/aspnetcore) ```yaml name: .NET Core CI on: [push] env: AZURE_WEBAPP_NAME: my-app-name # Set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: '.' # Set this to the path to your web app project, defaults to the repository root DOTNET_VERSION: '6.0.x' # Set this to the dot net version to use jobs: build: runs-on: ubuntu-latest steps: # Check out the repo - uses: actions/checkout@main # Setup .NET Core SDK - name: Setup .NET Core uses: actions/setup-dotnet@v3 with: dotnet-version: ${{ env.DOTNET_VERSION }} # Run dotnet build and publish - name: dotnet build and publish run: | dotnet restore dotnet build --configuration Release dotnet publish -c Release --property:PublishDir='${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp' # Deploy to Azure Web apps - name: 'Run Azure webapp deploy action using publish profile credentials' uses: azure/webapps-deploy@v3 with: app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} # Define secret variable in repository settings as per action documentation package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/myapp' ``` # [ASP.NET](#tab/aspnet) Build and deploy an ASP.NET model-view-controller (MVC) app that uses NuGet and `publish-profile` for authentication. ```yaml name: Deploy ASP.NET MVC App deploy to Azure Web App on: [push] env: AZURE_WEBAPP_NAME: my-app # Set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: '.' # Set this to the path to your web app project, defaults to the repository root NUGET_VERSION: '5.3.x' # Set this to the dot net version to use jobs: build-and-deploy: runs-on: windows-latest steps: - uses: actions/checkout@main - name: Install Nuget uses: nuget/setup-nuget@v1 with: nuget-version: ${{ env.NUGET_VERSION}} - name: NuGet to restore dependencies as well as project-specific tools that are specified in the project file run: nuget restore - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.0.2 - name: Run MSBuild run: msbuild .\SampleWebApplication.sln - name: 'Run Azure webapp deploy action using publish profile credentials' uses: azure/webapps-deploy@v3 with: app-name: ${{ env.AZURE_WEBAPP_NAME }} # Replace with your app name publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} # Define secret variable in repository settings as per action documentation package: '${{ env.AZURE_WEBAPP_PACKAGE_PATH }}/SampleWebApplication/' ``` # [Java SE](#tab/java) Build and deploy a Java Spring Boot app to Azure by using an Azure publish profile. The `publish-profile` input references the `AZURE_WEBAPP_PUBLISH_PROFILE` secret that you created earlier. ```yaml name: Java CI with Maven on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up JDK 1.8 uses: actions/setup-java@v3 with: java-version: 1.8 - name: Build with Maven run: mvn -B package --file pom.xml working-directory: my-app-path - name: Azure WebApp uses: Azure/webapps-deploy@v3 with: app-name: my-app-name publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} package: my/target/*.jar ``` To deploy a `war` instead of a `jar`, change the `package` value. ```yaml - name: Azure WebApp uses: Azure/webapps-deploy@v3 with: app-name: my-app-name publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} package: my/target/*.war ``` # [Tomcat](#tab/tomcat) Build and deploy a Tomcat app to Azure by using an Azure publish profile. The `publish-profile` input references the `AZURE_WEBAPP_PUBLISH_PROFILE` secret that you created earlier. ```yaml name: Build and deploy WAR app to Azure Web App using publish profile env: JAVA_VERSION: '11' # Set this to the Java version to use DISTRIBUTION: microsoft # Set this to the Java distribution AZURE_WEBAPP_NAME: sampleapp # Set this to the name of your web app on: [push] permissions: id-token: write contents: read jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Java version uses: actions/setup-java@v3.0.0 with: java-version: ${{ env.JAVA_VERSION }} distribution: ${{ env.DISTRIBUTION }} cache: 'maven' - name: Build with Maven run: mvn clean install - name: Deploy to Azure Web App id: deploy-to-webapp uses: azure/webapps-deploy@v3 with: app-name: ${{ env.AZURE_WEBAPP_NAME }} publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} package: '*.war' ``` Here's a [full example](https://github.com/Azure-Samples/onlinebookstore/blob/master/.github/workflows/azure-webapps-java-war-publish-profile.yml) that uses multiple jobs for build and deploy. # [Node.js](#tab/nodejs) > [!IMPORTANT] > If you're deploying a Node.js app with TypeScript or other compiled languages using `azure/webapps-deploy@v3`, build your app first in GitHub Actions and then deploy the compiled output folder (such as `dist/` or `build/`). If instead you want to use App Service build automation, [set the `SCM_DO_BUILD_DURING_DEPLOYMENT` app setting](../../configure-common.md#configure-app-settings) to `true`. Build and deploy a Node.js app to Azure by using the app's publish profile. The `publish-profile` input references the `AZURE_WEBAPP_PUBLISH_PROFILE` secret that you created earlier. ```yaml # File: .github/workflows/workflow.yml name: JavaScript CI on: [push] env: AZURE_WEBAPP_NAME: my-app-name # Set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: 'my-app-path' # Set this to the path to your web app project, defaults to the repository root NODE_VERSION: '24.x' # Set this to the node version to use jobs: build-and-deploy: name: Build and Deploy runs-on: ubuntu-latest steps: - uses: actions/checkout@main - name: Use Node.js ${{ env.NODE_VERSION }} uses: actions/setup-node@v4 with: node-version: ${{ env.NODE_VERSION }} - name: npm install, build, and test run: | # Build and test the project, then # deploy to Azure Web App. npm install npm run build --if-present npm run test --if-present working-directory: my-app-path - name: 'Deploy to Azure WebApp' uses: azure/webapps-deploy@v3 with: app-name: ${{ env.AZURE_WEBAPP_NAME }} publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} ``` # [Python](#tab/pythonn) Build and deploy a Python app to Azure by using the app's publish profile. Note how the `publish-profile` input references the `AZURE_WEBAPP_PUBLISH_PROFILE` secret that you created earlier. ```yaml name: Python CI on: [push] env: AZURE_WEBAPP_NAME: my-web-app # Set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: '.' # Set this to the path to your web app project, defaults to the repository root jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Python 3.x uses: actions/setup-python@v4 with: python-version: 3.x - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r requirements.txt - name: Building web app uses: azure/appservice-build@v2 - name: Deploy web App using GH Action azure/webapps-deploy uses: azure/webapps-deploy@v3 with: app-name: ${{ env.AZURE_WEBAPP_NAME }} publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }} package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }} ``` -----
Success! Branch created successfully. Create Pull Request on GitHub
Error: