generated fromactions/typescript-action
- Notifications
You must be signed in to change notification settings - Fork6
Example GitHub action to upload file(s) to Azure Blob Storage
License
NotificationsYou must be signed in to change notification settings
github-developer/upload-azure-blob
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is anexample GitHub action built in TypeScript that uploads file(s) toAzure Blob Storage, a "massively scalable and secure object storage for cloud-native workloads, archives, data lakes, high-performance computing, and machine learning".
Note: this action is meant solely for demonstration purposes. Best viewed together with the accompanyingblog post.
For more about GitHub Actions, refer tothe documentation.
- Use an existing Azure account orsign up for a free account
- Make sure you have access to a new or existing resource group, storage account, and container – for example, by following the first few steps ofthis quickstart
- Then,configure credentials that can write Azure Storage containers and blobs, like a service principal with the"Storage Blob Data Contributor" role.
az ad sp create-for-rbac --name $SP_NAME --sdk-auth --role "Storage Blob Data Contributor" --scopes /subscriptions/$SUBSCRIPTION_ID/resourceGroups/$RESOURCE_GROUP_NAME
- Finally, store these credentials as a secret named
AZURE_CREDENTIALS
Simple example:
# GitHub Actions repository workflow file, e.g .github/workflows/upload.yml# ...# previous steps to choose a runner type, prepare files, etc# ...-uses:azure/login@v1with:creds:${{ secrets.AZURE_CREDENTIALS }}# Upload `.png`s to Azure Blob Storage-name:Upload all PNGs to Azure Blob Storageid:uploaduses:github-developer/upload-azure-blob@v1with:account:octodexdestination:octocatssource:'**/*.png'# Print out the urls to uploaded files-name:Print URLsrun:echo $URLS# { ["filename":"hulatocat.png","url":"https://octodex.blob.core.windows.net/octocats/hulatocat.png"] }env:URLS:${{ steps.upload.outputs.urls }}# ...
account
(required): Storage account name, e.g.mystorageaccount
destination
(required): Name of container to upload blob to, e.g.$web
to upload a static website.source
(required): Path to file(s) to upload todestination
, e.g..
to upload all files in the current directory. Supports globbing, e.g.images/**.png
. For more information, please refer tohttps://www.npmjs.com/package/glob.
urls
: data structure with names and urls to uploaded files
Pull requests are welcome! SeeCONTRIBUTING.md for more.
About
Example GitHub action to upload file(s) to Azure Blob Storage
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.