【发布时间】:2021-01-05 12:00:14
【问题描述】:
我是第一次使用 github 操作。 我需要实现的是,当推送一个包含不同文件的项目(例如:json 文件和 txt 文件)时,我希望 github 操作仅将文件 .txt 推送到 azure 存储帐户。
现在,我的 github 管道结构如下,并且可以正常工作:
on: [push]
env:
AZURE_RESOURCE_GROUP: <resource-group-name>
BLOB_STORAGE_ACCOUNT_NAME: <storage-account-name>
# name: AzureARMDeploy
jobs:
modules:
runs-on: ubuntu-latest
steps:
- name: Login to Azure
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Checkout source code
uses: actions/checkout@v2
- name: Deploy to storage using CLI
uses: azure/CLI@v1
with:
azcliversion: latest
inlineScript: |
ls
# show azure account being used
az account show
# az storage account upload
az storage blob upload-batch --account-name ${{ env.BLOB_STORAGE_ACCOUNT_NAME }} -d '<storagename>' -s <folder>
az storage blob upload-batch --account-name ${{ env.BLOB_STORAGE_ACCOUNT_NAME }} -d '<storagename>' -s ./<folder name>/<file extentions>
在第一个upload-batch 中,我可以将所有内容文件夹复制到我的 azure 存储帐户。
在最后一批上传中:
az storage blob upload-batch --account-name ${{ env.BLOB_STORAGE_ACCOUNT_NAME }} -d '<storagename>' -s ./<folder name>/<file extentions>
我尝试过:
-s ./<folder name>/*.txt 但我得到一个错误:
ValidationError: incorrect usage: source must be an existing directory
我很确定错误是由*.txt 引起的,我想知道你们中是否有人知道如何实现这个逻辑的任何解决方案。
非常感谢您的宝贵时间和帮助。
【问题讨论】:
标签: github github-actions