Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
417 views
in Technique[技术] by (71.8m points)

javascript - 如何在Azure生成管道中打包JS应用并将其保存在单独的C#存储库中(How to package JS app in Azure Build Pipeline and Save in Separate C# Respository)

TL;DR - Using two separate repositories (because that's how I've inherited them) I'm attempting to run a custom script to build a JS-only app that is then copied and deployed along with a C# API app that's housed in a second respository.

(TL; DR-使用两个单独的存储库(因为这是我继承它们的方式),我试图运行一个自定义脚本来构建仅JS的应用程序,然后将其复制和部署,并将其与C#API应用程序一起放置在第二个存储库。)

Using Azure DevOps Services (cloud-based) for repos and pipelines.

(将Azure DevOps Services(基于云)用于存储库和管道。)

As I've indicated above I'm working my way through the process of running these scripts to create a single .js file that's ready to be deployed with our API (the JS app is called and created by a variety of our applications using this API).

(如上文所述,我正在逐步运行这些脚本,以创建一个单一的.js文件,该文件已准备好与我们的API一起部署(JS应用程序已由许多应用程序使用此API调用和创建) API)。)

My conundrum is how to approach this using Azure's Build Pipe as I can run the scripts but where the file(s) created are then being stored (and where to reference them) and then taking that file and inserting this creation into the repository of the C# API app, thereby kicking off a second build that would then deploy the C# app to the appropriate service.

(我的难题是如何使用Azure的构建管道来解决此问题,因为我可以运行脚本,但是将创建的文件存储到哪里(以及在何处引用它们),然后获取该文件并将此创建内容插入到该文件的存储库中。 C#API应用程序,从而启动第二个构建,然后再将C#应用程序部署到适当的服务。)

In another JS project I've successfully copied the files in my build pipes to then push these 'builds' to the appropriate environments but I'm at a loss for copying a specific file, following the npm run build-prod step to save and then insert a file in a known static location to the second repository.

(在另一个JS项目中,我已经成功复制了构建管道中的文件,然后将这些“构建”推送到适当的环境,但是在npm run build-prod步骤保存并保存之后,我对于复制特定文件不知所措。然后将文件插入第二个存储库的已知静态位置。)

NOTE: both repositories are located in the same organization.

(注意:两个存储库都位于同一组织中。)

Here's my uber rough draft YAML for the JS application:

(这是我针对JS应用程序的超级粗略YAML草案:)


trigger:
- master

pool:
  vmImage: 'vs2017-win2016'

steps:
- task: NodeTool@0
  inputs:
    versionSpec: '10.x'
  displayName: 'Install Node.js'

- script: |
    npm install
    npm run build-prod
  displayName: 'npm install and build-prod'

- task: CopyFiles@2
  inputs:
    SourceFolder: '$(agent.builddirectory)/dist/'
    Contents: '**'
    TargetFolder: '$(build.artifactstagingdirectory)'

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)/closet-api.js'
    ArtifactName: 'closet-api.js'
    publishLocation: 'Container'

Your help is appreciated!

(感谢您的帮助!)

  ask by Austin DeLaRosa translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...