         grunt.log.error("Parsing #{source} failed: #{e.message}")
         return false
 
+  grunt.registerTask 'postbuild', 'Run postbuild scripts', ->
+    done = @async()
+
+    exec 'git', ['rev-parse', '--short', 'HEAD'], (error, version) ->
+      if error?
+        done(false)
+      else
+        version = version.trim()
+        grunt.file.write(path.resolve(APP_DIR, '..', 'version'), version)
+
+        operations = []
+        operations.push (callback) ->
+          args = [
+            version
+            'resources/mac/app-Info.plist'
+            'Atom.app/Contents/Info.plist'
+          ]
+          exec('script/generate-info-plist', args, env: {BUILT_PRODUCTS_DIR: BUILD_DIR}, callback)
+
+        operations.push (result, callback) ->
+          args = [
+            version
+            'resources/mac/helper-Info.plist'
+            'Atom.app/Contents/Frameworks/Atom Helper.app/Contents/Info.plist'
+          ]
+          exec('script/generate-info-plist', args, env: {BUILT_PRODUCTS_DIR: BUILD_DIR}, callback)
+
+        grunt.util.async.waterfall operations, (error) -> done(!error?)
+
   grunt.registerTask 'clean', 'Delete all build files', ->
     rm BUILD_DIR
     rm '/tmp/atom-coffee-cache'

    cp 'static', path.join(APP_DIR, 'static'), filter: /.+\.less$/
    cp 'themes', path.join(APP_DIR, 'themes'), filter: /.+\.(cson|less)$/

    grunt.task.run('compile')

  grunt.registerTask 'install', 'Install the built application', ->
    rm INSTALL_DIR

{spawn} = require 'child_process'
fs = require 'fs'
path = require 'path'
_ = require 'underscore'
