Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions bin/OPL_releases/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,25 @@ command -v python >/dev/null 2>&1 ||
cd $LIBRARY_DIR
#verify_git_clean

######################################################################
#
# Test whether ARCHIVE_FORMATS contains at least one valid format
#

FOUND_VALID_FORMAT=0
VALID_ARCHIVE_FORMATS='.tar.gz .tar.bz2 .zip'
for VALID_FORMAT in $VALID_ARCHIVE_FORMATS
do
if [[ $ARCHIVE_FORMATS =~ $VALID_FORMAT ]]
then
FOUND_VALID_FORMAT=1;
fi;
done;
if [[ $FOUND_VALID_FORMAT == "0" ]]
then
warning "No valid archive format specified. You should set an environment variable ARCHIVE_FORMATS before with suitable values before running the script." ;
exit 1;
fi;

######################################################################
#
Expand Down Expand Up @@ -257,7 +276,7 @@ fi
#

# check if release already exists
response=$(curl -s -S -X GET "$API_URL/tags/$TAG?access_token=$TOKEN")
response=$(curl -s -S -X GET "$API_URL/tags/$TAG" -H "Authorization: token $TOKEN")
MESSAGE=$(json_get_key message)
RELEASE_ID=$(json_get_key id)

Expand All @@ -267,7 +286,7 @@ elif [ x"$RELEASE_ID" != x ] ; then
# release already exists -> error out or delete it
if [ "x$FORCE" = xyes ] ; then
notice "Deleting existing release $TAG from GitHub"
response=$(curl --fail -s -S -X DELETE "$API_URL/$RELEASE_ID?access_token=$TOKEN")
response=$(curl --fail -s -S -X DELETE "$API_URL/$RELEASE_ID" -H "Authorization: token $TOKEN")
MESSAGE=
else
error "release $TAG already exists on GitHub, aborting (use --force to override this)"
Expand All @@ -292,7 +311,7 @@ EOF

notice "Creating new release $TAG on GitHub"
response=$(curl -s -S -H "Content-Type: application/json" \
-X POST --data "$DATA" "$API_URL?access_token=$TOKEN")
-X POST --data "$DATA" "$API_URL" -H "Authorization: token $TOKEN")

MESSAGE=$(json_get_key message)
if [ x"$MESSAGE" != x ] ; then
Expand All @@ -304,25 +323,6 @@ if [ x"$RELEASE_ID" = x ] ; then
fi


######################################################################
#
# Test whether ARCHIVE_FORMATS contains at least one valid format
#

FOUND_VALID_FORMAT=0
VALID_ARCHIVE_FORMATS='.tar.gz .tar.bz2 .zip'
for VALID_FORMAT in $VALID_ARCHIVE_FORMATS
do
if [[ $ARCHIVE_FORMATS =~ $VALID_FORMAT ]]
then
FOUND_VALID_FORMAT=1;
fi;
done;
if [[ $FOUND_VALID_FORMAT == "0" ]]
then
warning "No valid archive format specified." ;
exit 1;
fi;

######################################################################
#
Expand Down