Azure DevOps存储库到Azure静态HTML CI / CD管道

时间:2019-12-14 23:29:36

标签: azure azure-pipelines continuous-deployment

我使用静态HTML功能在Azure存储中托管了一个静态HTML网站。我正在使用Azure DevOps Git Repo作为源控件。

当前,我正在手动推送更改的文件Azure存储,但希望自动执行该任务。触发器将是在更新master分支时,然后它应该更新Azure存储帐户($ web文件夹)。

我正在查看管道,并开始使用向导并选择了我的仓库。我看到“配置管道”的第一个选项称为HTML-存档静态HTML项目并将其保存在构建记录中。

它生成此YAML:

# HTML
# Archive your static HTML project and save it with the build record.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
- master

pool:
  vmImage: 'ubuntu-latest'

steps:
- task: ArchiveFiles@2
  inputs:
    rootFolderOrFile: '$(build.sourcesDirectory)'
    includeRootFolder: false
- task: PublishBuildArtifacts@1

问题:

  1. 这是完成我想做的正确模板吗?如果是,我需要添加/修改什么才能完成我的目标?
  2. 还有另一种方法可以实现我的目标吗?

1 个答案:

答案 0 :(得分:1)

您在正确的道路上。您将需要更新您的输入,使其类似于:

inputs:
rootFolderOrFile: ‘$(Build.SourcesDirectory)/dist’
archiveType: ‘zip’
archiveFile: ‘$(Build.ArtifactStagingDirectory)/$(Build.BuildId).zip’
replaceExistingArchive: true

还有一个博客可供您参考:

documentation