While trying Ghost I found myself in the need of updating the code to keep it up to date with the latest version available on github, and since both getting the updates and the deplyoment to Azure Web Sites is done via git I wrote a small batch file that automates the process.

#! /bin/bash
echo Pulling from Azure
git pull azure master
echo Pulling updates from origin
git pull origin
echo Compiling assets
grunt init
grunt prod
echo Committing to local repository
git commit -a -m "Applying changes from origin"
echo Pushing to Azure
git push azure master

A little explanation of what the script does:

  1. It pulls from Azure in case the site has been edited or updated already
  2. It pulls from the master of Ghost to get the latest changes
  3. Executes the grunt build file: compiles Sass, concat javascript files and finally mininfy them
  4. It commits to the local repository all the changes (including all the generated files)
  5. A finally pushes to git repository used by the Azure Web Site
Tags: ,,