Skip to content

Instantly share code, notes, and snippets.

@sanderson
Created March 6, 2018 15:41
Show Gist options
  • Save sanderson/105e287fb2838fe94282729fe1d9470f to your computer and use it in GitHub Desktop.
Save sanderson/105e287fb2838fe94282729fe1d9470f to your computer and use it in GitHub Desktop.
Semaphore CI & Nanobox

Simple Script Using Nanobox with Semaphore

Using Semaphore with Nanobox is a really easy way to test your app and automate deploys. The steps included in this gist will:

  1. Install the Nanobox binary on your CI server
  2. Use Nanobox to run any tests included with your codebase
  3. Specify the appropriate remote based on the git branch
  4. Deploy to the added remote appending the latest git commit message as the deploy message
nanobox run test-command
if [ "$BRANCH_NAME" = "master" ]; then nanobox remote add production-app ; elif [ "$BRANCH_NAME" = "staging" ]; then nanobox remote add staging-app ; fi
COMMIT_MESSAGE="$(git log -1 --pretty=%B)"; nanobox deploy -m \'"${COMMIT_MESSAGE}"\'
sudo bash -c "$(curl -fsSL https://s3.amazonaws.com/tools.nanobox.io/bootstrap/ci.sh)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment