我有三个部署 Staging/beta/Production,对于这三个部署,每个后端都有不同的 .env 文件。 我已将三个文件上传到库中的 secureFiles 中,现在我想下载这些文件并将文件复制到 wwwroot 文件夹中。如何做到这一点?
我正在下载 secureFile,但无法将文件复制到正确的目录中
在 DevOps
DownloadSecureFile@1
任务中,安全文件将下载到路径:$(taskname.secureFilePath)
(链接此处)。您只需将此路径复制到目标文件夹即可。
请检查下面的示例 yaml:
pool:
vmImage: 'ubuntu-latest'
steps:
- task: DownloadSecureFile@1
name: first
inputs:
secureFile: 'test1.env'
- task: DownloadSecureFile@1
name: second
inputs:
secureFile: 'test2.env'
- task: DownloadSecureFile@1
name: third
inputs:
secureFile: 'test3.env'
- script: mkdir -p home/site/wwwroot # crate the wwwroot folder because it doesn't exist on my repo.
- script: |
cp $(first.secureFilePath) home/site/wwwroot # copy the env files to wwwroot
cp $(second.secureFilePath) home/site/wwwroot
cp $(third.secureFilePath) home/site/wwwroot
我创建了用于检查的工件: