【问题标题】:Azure DevOps Repo to Azure Static HTML CI/CD PipelineAzure DevOps Repo 到 Azure 静态 HTML CI/CD 管道
【发布时间】:2020-04-07 22:30:42
【问题描述】:

我有一个使用静态 HTML 功能托管在 Azure 存储中的静态 HTML 网站。我使用 Azure DevOps Git Repo 作为我的源代码控制。

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

我正在查看 Pipelines 并开始使用向导并选择了我的 repo。我看到“配置您的管道”的第一个选项称为 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. 还有其他方法可以实现我的目标吗?

【问题讨论】:

    标签: azure azure-pipelines continuous-deployment


    【解决方案1】:

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

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

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

    https://medium.com/@matthewleak/deploying-a-static-website-to-azure-storage-using-azure-devops-fa0bed457d07

    【讨论】:

    • 我的设置与 OP 相同,但存档任务包括 .git 文件及其在 zip 存档中的所有内容。如何将 .get 排除在 zip 存档中?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-12-20
    • 2022-07-04
    • 2020-10-13
    • 1970-01-01
    • 2022-01-02
    • 2021-09-14
    • 2022-01-22
    相关资源
    最近更新 更多