Skip to content
box

GitHub Action

Azure Blob Storage Upload

v3.0.0 Latest version

Azure Blob Storage Upload

box

Azure Blob Storage Upload

Uploads assets to Azure Blob Storage

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Azure Blob Storage Upload

uses: bacongobbler/azure-blob-storage-upload@v3.0.0

Learn more about this action in bacongobbler/azure-blob-storage-upload

Choose a version

GitHub Action to Upload Assets to Azure Blob Storage

This action is designed to use the Azure CLI to upload a directory of your choice to your Azure Blob Storage account.

Usage

Example

Place in a .yml file such as this one in your .github/workflows folder. Refer to the documentation on workflow YAML syntax here.

name: Upload To Azure Blob Storage
on:
  push:
    branches:
      - main
jobs:
  upload:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: bacongobbler/azure-blob-storage-upload@main
        with:
          source_dir: _dist
          container_name: www
          connection_string: ${{ secrets.ConnectionString }}
          extra_args: '--pattern *.tar.gz'
          # WARNING: this will overwrite existing blobs in your blob storage
          overwrite: 'true'

If you want to synchronize local and remote state (for example, if you are publishing a static website), enable the sync flag.

Required Variables

Key Value
container_name The name of the storage account container these assets will be uploaded to
source_dir The name of the directory you want to upload

Optional Variables

Key Value
account_name The name of the storage account. Required if sas_token is used
connection_string The connection string for the storage account. Used if value is set. Either connection_string or sas_token must be supplied
extra_args Extra arguments that can be passed to az storage blob upload-batch. Useful for passing flags like --pattern or --destination-path
overwrite Overwrite existing files in the destination container. Defaults to false
sas_token The shared access signature token for the storage account. Either connection_string or sas_token must be supplied
sync Use az storage blob sync to synchronize blobs recursively. Defaults to false (az storage blob upload-batch)

License

This project is distributed under the Apache 2 license.