簡體   English   中英

Azure DevOps 存儲庫到 Azure 靜態 HTML CI/CD 管道

[英]Azure DevOps Repo to Azure Static HTML CI/CD Pipeline

我在 Azure 存儲中使用靜態 HTML 功能托管了一個靜態 HTML 網站。 我使用 Azure DevOps Git Repo 作為我的源代碼控制。

目前我正在手動推送更改的文件 Azure 存儲,但希望自動執行該任務。 觸發器將在主分支更新時更新 Azure 存儲帳戶($web 文件夾)。

我正在查看 Pipelines 並開始使用向導並選擇了我的存儲庫。 我看到“配置您的管道”的第一個選項稱為 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. 還有其他方法可以實現我的目標嗎?

你走在正確的道路上。 您需要將輸入更新為類似於:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM