#!/bin/bash

set -e

COMPOUND_VERSION=$1
TAG=$2
VIMR_FILE_NAME=$3
RELEASE_NOTES=$4
IS_SNAPSHOT=$5

pushd build/Release

tar cjf ${VIMR_FILE_NAME} VimR.app

echo "### Creating release"
if [ "${IS_SNAPSHOT}" = true ] ; then
    GITHUB_TOKEN=$(cat ~/.config/github.qvacua.release.token) github-release release \
        --user qvacua \
        --repo vimr \
        --tag "${TAG}" \
        --pre-release \
        --name "${COMPOUND_VERSION}" \
        --description "${RELEASE_NOTES}"
else
    GITHUB_TOKEN=$(cat ~/.config/github.qvacua.release.token) github-release release \
        --user qvacua \
        --repo vimr \
        --tag "${TAG}" \
        --name "${COMPOUND_VERSION}" \
        --description "${RELEASE_NOTES}"
fi


echo "### Uploading build"
GITHUB_TOKEN=$(cat ~/.config/github.qvacua.release.token) github-release upload \
    --user qvacua \
    --repo vimr \
    --tag "${TAG}" \
    --name "${VIMR_FILE_NAME}" \
    --file "${VIMR_FILE_NAME}"

#!/bin/bash

set -e

COMPOUND_VERSION=$1
TAG=$2
VIMR_FILE_NAME=$3
RELEASE_NOTES=$4
IS_SNAPSHOT=$5

pushd build/Release

tar cjf ${VIMR_FILE_NAME} VimR.app

PRERELEASE=""
if [ "${IS_SNAPSHOT}" = true ] ; then
    PRERELEASE="--pre-release"
fi

echo "### Creating release"
GITHUB_TOKEN=$(cat ~/.config/github.qvacua.release.token) github-release release \
    --user qvacua \
    --repo vimr \
    --tag "${TAG}" \
    --name "${COMPOUND_VERSION}" "${PRERELEASE}" \
    --description "${RELEASE_NOTES}"

echo "### Uploading build"
GITHUB_TOKEN=$(cat ~/.config/github.qvacua.release.token) github-release upload \
    --user qvacua \
    --repo vimr \
    --tag "${TAG}" \
    --name "${VIMR_FILE_NAME}" \
    --file "${VIMR_FILE_NAME}"

--- 
+++ 
@@ -12,24 +12,18 @@
 
 tar cjf ${VIMR_FILE_NAME} VimR.app
 
-echo "### Creating release"
+PRERELEASE=""
 if [ "${IS_SNAPSHOT}" = true ] ; then
-    GITHUB_TOKEN=$(cat ~/.config/github.qvacua.release.token) github-release release \
-        --user qvacua \
-        --repo vimr \
-        --tag "${TAG}" \
-        --pre-release \
-        --name "${COMPOUND_VERSION}" \
-        --description "${RELEASE_NOTES}"
-else
-    GITHUB_TOKEN=$(cat ~/.config/github.qvacua.release.token) github-release release \
-        --user qvacua \
-        --repo vimr \
-        --tag "${TAG}" \
-        --name "${COMPOUND_VERSION}" \
-        --description "${RELEASE_NOTES}"
+    PRERELEASE="--pre-release"
 fi
 
+echo "### Creating release"
+GITHUB_TOKEN=$(cat ~/.config/github.qvacua.release.token) github-release release \
+    --user qvacua \
+    --repo vimr \
+    --tag "${TAG}" \
+    --name "${COMPOUND_VERSION}" "${PRERELEASE}" \
+    --description "${RELEASE_NOTES}"
 
 echo "### Uploading build"
 GITHUB_TOKEN=$(cat ~/.config/github.qvacua.release.token) github-release upload \
Fix build script (for real...)
