Skip to content

Instantly share code, notes, and snippets.

@michaeltlombardi
Created April 26, 2016 20:41
Show Gist options
  • Save michaeltlombardi/0a14ef8eff0fe34bae3b0d7ed87703aa to your computer and use it in GitHub Desktop.
Save michaeltlombardi/0a14ef8eff0fe34bae3b0d7ed87703aa to your computer and use it in GitHub Desktop.
Upload the required info for a mkdocs site to an Azure Storage Blob
#!/bin/sh
export AZURE_STORAGE_ACCOUNT='Your_Account_here'
export AZURE_STORAGE_ACCESS_KEY='Your_Key_Here'
export container_name='Your_Container_Here'
export source_folder=~/local/path/to/your/site/folder/*
export version='vX.Y.Z' # Replace this with the appropriate version for your docs.
export doclang='en-US' # Replace this if the language isn't American English.
root_folder=${source_folder:0:(-1)}
for file in $(find $root_folder -type f)
do
echo "Uploading file $file"
# Since we're deploying a static site we want to keep the folder structure intact.
# This script assumes your mkdocs site is built in the site folder. Alter the regex
# if it isn't.
azure storage blob upload $file $container_name $version/$doclang/$(echo $file | sed "s/^\/.*site\///")
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment