#!/usr/bin/env bash

GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`
TEMPLATEFILE=file://$GOPATH/src/code.justin.tv/vod/vodapi/deployments/pipelines/development.yaml
PARAMSFILE=file://$GOPATH/src/code.justin.tv/vod/vodapi/deployments/pipelines/development-params-temp.json

sed "s/__BRANCHNAME__/${GIT_BRANCH}/g" deployments/pipelines/development-params.json > deployments/pipelines/development-params-temp.json
aws cloudformation create-stack --profile twitch-vodapi-aws --stack-name vodapi-pipeline-dev-$GIT_BRANCH --template-body $TEMPLATEFILE --parameters $PARAMSFILE --capabilities CAPABILITY_NAMED_IAM
rm deployments/pipelines/development-params-temp.json
