Reputation: 169
I am struggling to get a simple build and deploy working and was hoping for some assistance. Could anyone review the steps and also why the Publish Artifacts does not work? It's a simple Angular 7 project.
Error:
[section]Starting: Publish Artifact: dist ========================================================================== Task: Publish Build Artifacts Description: Publish build artifacts to Azure Pipelines/TFS or a file share Version: 1.142.2 Author : Microsoft Corporation Help : More Information
[warning]Directory 'D:\a\1\s\dist' is empty. Nothing will be added to build artifact 'dist'. [section]Finishing: Publish Artifact: dist
YAML:
pool:
vmImage: Hosted VS2017
demands: npm
steps:
- script: |
echo Write your commands here
mkdir dist
echo Use the environment variables input below to pass secret variables to this script
displayName: 'Command - mkdir dist'
- task: Npm@1
displayName: 'npm install'
inputs:
verbose: false
- task: Npm@1
displayName: 'npm build'
inputs:
command: custom
verbose: false
customCommand: 'build --prod'
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: dist'
inputs:
PathtoPublish: dist
ArtifactName: dist
- task: FtpUpload@1
displayName: 'FTP Upload: dist'
inputs:
credentialsOption: inputs
serverUrl: ‘xxx’
username: Tester2
password: 'Tester$2'
rootDirectory: dist
filePatterns: '*'
remoteDirectory: /
trustSSL: true
Upvotes: 2
Views: 1816
Reputation: 76660
Azure DevOps Pipeline issue
The Publish Build Artifacts task is used to publish build artifacts to Azure Pipelines, TFS, or a file share.
But, just like Daniel and Andrey said, although you add the npm build
, you did not set the installed folder to be dist
. So the result of npm build
will not be saved in the dist folder. In this case, the folder dist
is empty.
Besides, to save the build result to the dist folder, you can try to use the option -- -op
like following:
run ng build --prod -- -op ..\..\dist
The ..\..\dist
should use relative path based on the project.json
file.
Check the document JavaScript frameworks: AngularJS for some more details info.
Hope this helps.
Upvotes: 1