microsoft / azuredevopslabs

Learn how you can plan smartly, collaborate better, and ship faster with a set of modern development services with Azure DevOps.
https://www.azuredevopslabs.com
MIT License
826 stars 920 forks source link

azure devops doing overwriting issue with reactjs #532

Open bilalmalik777 opened 3 years ago

bilalmalik777 commented 3 years ago

I create a build pipeline in Azure DevOps for reactjs, it builds the code into somerandomNumber.zip. Under zip file, there is a build folder in which all publish code exists. In iis web app manages the task in release, the physical path is given following %SystemDrive%\inetpub\wwwroot\build. it deploys the code in wwwroot/build/build, actually it must deploy into wwwroot/build/ not in wwwroot/build/build. owing to which everytime i have to copy code from the innermost build folder to the outer build folder. please help me to sort out this problem. Build and release configuration are given below

React build pipeline

trigger:
- React-Development
variables:
  uiSource: 'Source/Core/TT.Core.Portal/React-Application'
  uireactcode: '$(uisource)/projects/tt-core'
  uiBuild: '$(uisource)/projects/tt-core/build'

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: YarnInstaller@3
  inputs:
    versionSpec: '1.x'
    checkLatest: true
  displayName: 'Install Yarn'

- script: |
    pushd '$(uireactcode)'
    yarn    
    popd
  displayName: 'yarn install React Code'

- script: |
    pushd '$(uiSource)'
    yarn
    yarn build:tt-core  
    popd
  displayName: 'yarn install and build'
- task: ArchiveFiles@2
  inputs:
    rootFolderOrFile: '$(uiBuild)'
    includeRootFolder: true
    archiveType: 'zip'
    archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip'
    replaceExistingArchive: true

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'

React Release

steps:
- task: IISWebAppManagementOnMachineGroup@0
  displayName: 'Manage IISWebsite React'
  inputs:
    WebsiteName: 'tt-test-react-portal'
    WebsitePhysicalPath: '%SystemDrive%\inetpub\wwwroot\build'

steps:
- task: IISWebAppDeploymentOnMachineGroup@0
  displayName: 'Deploy IIS Website React'
  inputs:
    WebSiteName: 'tt-test-react-portal'
    Package: '$(System.DefaultWorkingDirectory)/_React/drop/*.zip'