Skip to content

Commit

Permalink
Add a version.json builder (mozilla#1644)
Browse files Browse the repository at this point in the history
  • Loading branch information
chuckharmston authored Oct 21, 2016
1 parent f41d6ef commit 3f06d15
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
14 changes: 14 additions & 0 deletions bin/build-version-json.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

echo "$(dirname $0)"
cd $(dirname $0)/..

HASH=$(git --no-pager log --format=format:"%H" -1)
TAG=$(git show-ref --tags | awk "/$HASH/ {print \$NF}" | sed 's/refs.tags.//')

printf '{"commit":"%s","version":"%s","source":"https://github.com/mozilla/testpilot"}\n' \
"$HASH" \
"$TAG" \
> version.json

cat version.json
21 changes: 13 additions & 8 deletions bin/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,16 @@ for fn in $(find dist -name 'index.html' -not -path 'dist/index.html'); do
$fn s3://${TESTPILOT_BUCKET}/${s3path}
done

# __version__ JSON; 10 minute cache
aws s3 cp \
--cache-control "max-age=${MAX_AGE}" \
--content-type "application/json" \
--metadata "{${HPKP}, ${HSTS}, ${TYPE}}" \
--metadata-directive "REPLACE" \
--acl "public-read" \
version.json s3://${TESTPILOT_BUCKET}/__version__
# build version.json
$(dirname $0)/build-version-json.sh

if [ -e version.json ]; then
# __version__ JSON; 10 minute cache
aws s3 cp \
--cache-control "max-age=${MAX_AGE}" \
--content-type "application/json" \
--metadata "{${HPKP}, ${HSTS}, ${TYPE}}" \
--metadata-directive "REPLACE" \
--acl "public-read" \
version.json s3://${TESTPILOT_BUCKET}/__version__
fi

0 comments on commit 3f06d15

Please sign in to comment.