#!/usr/bin/env bash
set -euo pipefail

bright_green='\u001b[32;1m'
reset_color='\033[0m'

main(){
  setup
  upload
  display_location
}

setup(){
    current_directory="$(pwd)"

    cleanup() {
        cd ${current_directory}
    }
    trap cleanup EXIT
}

upload(){
  aws s3 sync ./storybook-static s3://zoox-web/spectrum-ui/storybook
}

display_location(){
  echo -e "${bright_green}
  View storybook on http://spectrum-ui.web.zooxlabs.com/storybook/index.html
  ${reset_color}"
}

main
