bestander / grunt-azure-cdn-deploy

Grunt task for copying files to azure storage
MIT License
13 stars 3 forks source link

grunt-azure-cdn-deploy

A Grunt plugin for for uploading files to Azure Blob Storage. Wraps a vanilla node package https://github.com/bestander/deploy-azure-cdn. It is perfect for deploying compiled assets to Microsoft Azure CDN as a last step in a Continuous Integration setup.

Features

Installing

npm install grunt-azure-cdn-deploy

Using

Deploying a set of files to a path in blob storage


 grunt.loadNpmTasks('grunt-azure-cdn-deploy');
  grunt.initConfig({
    'azure-cdn-deploy': {
      app: {
        options: {
          containerName: 'test', // container name in blob
          serviceOptions: ['blobstoragename', '/OwQ/MyLongSecretStringFromAzureConfigPanel'], // custom arguments to azure.createBlobService
          folder: '1.2.35-b27', // path within container
          zip: true, // gzip files if they become smaller after zipping, content-encoding header will change if file is zipped
          deleteExistingBlobs: true, // true means recursively deleting anything under folder
          concurrentUploadThreads: 10, // number of concurrent uploads, choose best for your network condition
          metadata: {
            cacheControl: 'public, max-age=31530000', // cache in browser
            cacheControlHeader: 'public, max-age=31530000' // cache in azure CDN. As this data does not change, we set it to 1 year
          },
          testRun: false // test run - means no blobs will be actually deleted or uploaded, see log messages for details
        },
        src: [
          'src/*.{js,json}',
          '*.md',
          '.gitignore'
        ],
        cwd: './node_modules/deploy-azure-cdn'
      }
    }
  });

Debugging

run

grunt azure-cdn-deploy --debug

To see the log of deleted and uploaded files

Parameters