0 votes
1 view
in Azure by (10.6k points)

I am not able to understand how to build/release pipelines setup for deploying application of NestJS to Azure DevOps. Herewith I attached my YAML :

trigger:

- master

pool:

  vmImage: 'ubuntu-latest'

steps:

- task: [email protected]

  inputs:

    version: '14.x'

    checkLatest: true

- task: [email protected]

  displayName: Run NPM Update for NestJS

  inputs:

    cwd: '$(Build.SourcesDirectory)/ProjectName'

    command: update

- task: [email protected]

  displayName: Build NestJS

  inputs:

    cwd: '$(Build.SourcesDirectory)/ProjectName'

    command: run

    arguments: "build"

- task: [email protected]

  inputs:

    Contents: 'dist/**'

    TargetFolder: '$(Build.ArtifactStagingDirectory)'

So, the problem is I am not able to see the "dist" folder in /home/site/wwwroot/ProjectName. Can anyone help me with this? What I am missing?

1 Answer

0 votes
by (21.5k points)

You have to use Azure App service Deploy task or Azure Web App task to deploy your app which is hosted in Azure. Now, to do that, firstly you need to create a service connection to Azure DevOps to connect your Azure Subscription. And after that, you need to add Azure App Service Deploy task/Azure Web App task at the end of your pipeline.

Prefer this example to understand it better.

- task: [email protected]

  inputs:

    ConnectionType: 'AzureRM'

    azureSubscription: 'SubscriptionServiceConnectionName'

    appType: 'webAppLinux'

    WebAppName: 'MyWebAppName'

    Package: '$(Build.ArtifactStagingDirectory)/dist/'

    StartupCommand: 'npm run start:prod'

I hope this will work.

Want to become an Azure DevOps expert? join azure devops certification now!!

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...