使用github操作将特定文件扩展名推送到azure存储帐户
我第一次与github action合作。 我需要实现的是,当推送一个包含不同文件(例如:json文件和txt文件)的项目时,我希望github操作只将文件.txt推送到azure存储帐户 现在,我的github管道的结构如下所示,并且可以正常工作:使用github操作将特定文件扩展名推送到azure存储帐户,github,github-actions,Github,Github Actions,我第一次与github action合作。 我需要实现的是,当推送一个包含不同文件(例如:json文件和txt文件)的项目时,我希望github操作只将文件.txt推送到azure存储帐户 现在,我的github管道的结构如下所示,并且可以正常工作: on: [push] env: AZURE_RESOURCE_GROUP: <resource-group-name> BLOB_STORAGE_ACCOUNT_NAME: <storage-account-name&g
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>
我试过:
-s.//*.txt
但我得到一个错误:
ValidationError: incorrect usage: source must be an existing directory
我很确定这个错误是由*.txt
引起的,我想知道你们是否知道如何实现这个逻辑的解决方案
非常感谢您的时间和帮助。您可以使用--pattern
标志
--pattern
The pattern used for globbing files or blobs in the source. The supported patterns are '*', '?', '[seq]', and '[!seq]'. For more information, please refer to https://docs.python.org/3.7/library/fnmatch.html.
那就好像
az storage blob upload-batch --account-name ${{ env.BLOB_STORAGE_ACCOUNT_NAME }} -d '<storagename>' -s './<folder name>' --pattern "*.txt"
az storage blob上载批处理--帐户名${{env.blob\u storage\u account\u name}-d'-s'/'--模式“*.txt”
它成功了。非常感谢你,伙计。你是一个leggend@NaydenVan如果你对我有帮助的话,你能考虑一下我的回答吗?谢谢你,这真是太好了,抱歉,我有什么办法能把不同的子目录中的JSON文件推到一个存储区?我一直有一个错误,我找不到解决它的方法
az storage blob upload-batch --account-name ${{ env.BLOB_STORAGE_ACCOUNT_NAME }} -d '<storagename>' -s './<folder name>' --pattern "*.txt"