awscli/build.sh

60 lines
1.3 KiB
Bash
Raw Permalink Normal View History

2016-06-24 20:38:54 +00:00
#!/bin/bash -e
HOST_OS=$(uname -s)
### ---- ###
2016-08-09 15:39:16 +00:00
echo "Switch back to latest"
git checkout latest
git reset --hard origin/latest
2016-06-24 20:38:54 +00:00
### ---- ###
if ! [ -e jq ]; then
echo "Loading local copy of jq-1.5"
case ${HOST_OS} in
Linux)
curl -sSLo ./jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
;;
Darwin)
curl -sSLo ./jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-osx-amd64
;;
*)
echo "/!\\ Unable to download jq for ${HOST_OS}"
exit 1
;;
esac
chmod +x jq
fi
### ---- ###
echo "Fetching latest version number of awscli"
AWSCLI_VERSION=$(curl -sSL https://pypi.python.org/pypi/awscli/json | ./jq -r .info.version)
if ( git tag -l ${AWSCLI_VERSION} | grep -q ${AWSCLI_VERSION} ); then
echo "/!\\ Already got a tag for version ${AWSCLI_VERSION}, stopping now"
exit 0
fi
echo "Writing requirements.txt"
echo "awscli==${AWSCLI_VERSION}" > requirements.txt
### ---- ###
echo "Testing build..."
docker build .
### ---- ###
echo "Updating repository..."
git add requirements.txt
git -c user.name='travis' -c user.email='travis' \
commit -m "awscli ${AWSCLI_VERSION}"
git tag ${AWSCLI_VERSION}
2016-08-09 15:39:16 +00:00
git push -q https://${GH_USER}:${GH_TOKEN}@github.com/luzifer-docker/awscli latest --tags