Commit b28c062f0e6542aacd81fb3532b8818a05df5659
1 parent
3a9db618
Exists in
master
and in
17 other branches
Make error handling and control flow more verbose
Showing
1 changed file
with
27 additions
and
7 deletions
Show diff stats
release.sh
@@ -9,13 +9,33 @@ function error_exit | @@ -9,13 +9,33 @@ function error_exit | ||
9 | exit 1 | 9 | exit 1 |
10 | } | 10 | } |
11 | 11 | ||
12 | -git diff --quiet HEAD || error_exit 'uncommited changes' | ||
13 | -git describe --exact-match || error_exit 'HEAD is not tagged' | ||
14 | -bin/omnibus clean --purge ${PROJECT} || error_exit 'clean failed' | ||
15 | -touch build.txt | ||
16 | -OMNIBUS_APPEND_TIMESTAMP=0 bin/omnibus build project ${PROJECT} || error_exit 'build failed' | 12 | +if !(git diff --quiet HEAD); then |
13 | + error_exit 'uncommited changes' | ||
14 | +fi | ||
15 | + | ||
16 | +if !(git describe --exact-match); then | ||
17 | + error_exit 'HEAD is not tagged' | ||
18 | +fi | ||
19 | + | ||
20 | +if !(bin/omnibus clean --purge ${PROJECT}); then | ||
21 | + error_exit 'clean failed' | ||
22 | +fi | ||
23 | + | ||
24 | +if !(touch build.txt); then | ||
25 | + error_exit 'failed to mark build start time' | ||
26 | +fi | ||
27 | + | ||
28 | +if !(OMNIBUS_APPEND_TIMESTAMP=0 bin/omnibus build project ${PROJECT}); then | ||
29 | + error_exit 'build failed' | ||
30 | +fi | ||
31 | + | ||
17 | release_package=$(find pkg/ -mnewer build.txt -type f -not -name '*.json') | 32 | release_package=$(find pkg/ -mnewer build.txt -type f -not -name '*.json') |
18 | if [[ -z ${release_package} ]]; then | 33 | if [[ -z ${release_package} ]]; then |
19 | - error_exit 'Could not find the release package' | 34 | + error_exit 'could not find the release package' |
20 | fi | 35 | fi |
21 | -aws s3 cp ${release_package} s3://#{RELEASE_BUCKET} --acl public-read --region ${RELEASE_BUCKET_REGION} | 36 | + |
37 | +if !(aws s3 cp ${release_package} s3://#{RELEASE_BUCKET} --acl public-read --region ${RELEASE_BUCKET_REGION}); then | ||
38 | + error_exit 'release upload failed' | ||
39 | +fi | ||
40 | + | ||
41 | +echo "$0: package uploaded to https://${RELEASE_BUCKET}.s3.amazonaws.com/${release_package}" |