Skip to content

Instantly share code, notes, and snippets.

@jimbojsb
Created March 20, 2012 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimbojsb/2140944 to your computer and use it in GitHub Desktop.
Save jimbojsb/2140944 to your computer and use it in GitHub Desktop.
Bamboo is dead, long live bamboo
<?php
chdir("/home/offers/www/offers-qa/coral");
`git checkout next`;
`git reset --hard HEAD`;
`git pull`;
chdir("/home/offers/www/offers-qa/orca");
`git checkout next`;
`git reset --hard HEAD`;
`git pull`;
$date = `git log --max-count=1 | grep Date`;
$date = trim(str_replace('Date:', '', $date));
$timestamp = strtotime($date);
$lastrun = trim(@file_get_contents('/home/offers/www/offers-qa/lastbuild')) ?: 0;
echo $timestamp . " : " . $lastrun . PHP_EOL;
if ($timestamp > $lastrun && !file_exists("/home/offers/www/offers-qa/building")) {
touch("/home/offers/www/offers-qa/building");
file_put_contents('/home/offers/www/offers-qa/lastbuild', time());
chdir("/home/offers/www/offers-qa/orca/build");
copy("/home/offers/www/offers-qa/build.properties", "/home/offers/www/offers-qa/orca/build/build.properties");
copy("/home/offers/www/offers-qa/keys.xml", "/home/offers/www/offers-qa/orca/keys.xml");
$log = `APPLICATION_ENV=qa /usr/bin/env phing build-qa 2>&1`;
echo $log;
file_put_contents("/home/offers/www/offers-qa/buildlog", $log);
unlink("/home/offers/www/offers-qa/building");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment