Skip to content

Commit

Permalink
Create nextbuildver.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
PeckTonium authored Aug 17, 2017
1 parent 3b12dd8 commit 3b216f5
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions nextbuildver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh
#set -e
#
# nextbuildver.sh
# Find the next build version number and either return it if no arguments
# were passed in, or insert/append it to the filename passed in
# If the argument passed in has a dot in it, the version will be inserted
# before the dot with a leading underscore
# eg: abc -> abc_4.2.4 or a.sh -> a_4.2.4.sh
#
# Expects one environment variable to exist:
# artifact_name - the base filename to calculate the build number for
# s3_bucket - the bucket where artifacts reside (to see latest one)

echo "Starting nextbuildver.sh"

if [[ $# > 2 ]]; then
echo "Error: There must be at most one argument. If present, it must \
be a filename to be modified"
exit 1
fi

if [[ -n "$1" ]]; then
fname="$1"
echo "got filename=$fname"
else
if [[ -z "$1" ]]; then
echo "got -z \$1"
fi
fi

if [[ -z "$artifact_name" ]]; then
echo "Error: Missing environment variable \$artifact_name"
exit 1
fi

if [[ -z "$s3_bucket" ]]; then
echo "Error: Missing environment variable \$s3_bucket"
exit 1
fi

0 comments on commit 3b216f5

Please sign in to comment.