|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +SOURCE="${BASH_SOURCE[0]}" |
| 4 | +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink |
| 5 | + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" |
| 6 | + SOURCE="$(readlink "$SOURCE")" |
| 7 | + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located |
| 8 | +done |
| 9 | +DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" |
| 10 | + |
| 11 | +host= |
| 12 | +version= |
| 13 | + |
| 14 | +while getopts "v:n:" opt; do |
| 15 | + case $opt in |
| 16 | + n) |
| 17 | + echo "Host is $OPTARG" >&2 |
| 18 | + host=$OPTARG |
| 19 | + ;; |
| 20 | + v) |
| 21 | + echo "Version is $OPTARG" >&2 |
| 22 | + version=$OPTARG |
| 23 | + ;; |
| 24 | + \?) |
| 25 | + echo "Invalid option: -$OPTARG" >&2 |
| 26 | + exit 1 |
| 27 | + ;; |
| 28 | + esac |
| 29 | +d``one |
| 30 | + |
| 31 | +echo -e "Preparing binary release\n=====================\n" |
| 32 | +echo -e "Version = ${version}" |
| 33 | +echo -e "Host = ${host}" |
| 34 | + |
| 35 | +# create the binary directory |
| 36 | +betaname=RapMap-${version}_${host} |
| 37 | +mkdir ${DIR}/../RELEASES |
| 38 | +mkdir ${DIR}/../RELEASES/${betaname} |
| 39 | +mkdir ${DIR}/../RELEASES/${betaname}/bin |
| 40 | +mkdir ${DIR}/../RELEASES/${betaname}/lib |
| 41 | + |
| 42 | +echo -e "Copying over the binary\n" |
| 43 | +cp ${DIR}/../bin/rapmap ${DIR}/../RELEASES/${betaname}/bin/ |
| 44 | + |
| 45 | +# copy other dependencies (shared libraries) |
| 46 | +#echo -e "Copying over other shared library dependencies\n" |
| 47 | +#bash ${DIR}/../scripts/cpld.bash ${DIR}/../bin/salmon ${DIR}/../RELEASES/${betaname}/lib/ |
| 48 | +#echo -e "Removing dangerous dependencies\n" |
| 49 | +#rm ${DIR}/../RELEASES/${betaname}/lib/libc.so.6 |
| 50 | +#rm ${DIR}/../RELEASES/${betaname}/lib/ld-linux-x86-64.so.2 |
| 51 | +#rm ${DIR}/../RELEASES/${betaname}/lib/libdl.so.2 |
| 52 | +#rm ${DIR}/../RELEASES/${betaname}/lib/libpthread*.so.* |
| 53 | + |
| 54 | +# now make the tarball |
| 55 | +echo -e "Making the tarball\n" |
| 56 | +cd ${DIR}/../RELEASES |
| 57 | +tar czvf ${betaname}.tar.gz ${betaname} |
| 58 | + |
| 59 | +echo -e "Done making release!" |
| 60 | + |
| 61 | +#echo -e "Pushing the tarball to GitHub\n" |
| 62 | +## Since it's currently unclear to me how to overwrite an asset via the GitHub |
| 63 | +## API, the following code deletes the old asset, and uploads the new one in its place |
| 64 | +# |
| 65 | +## Get the previous asset id of the tarball |
| 66 | +#echo -e "Getting previous asset ID\n" |
| 67 | +#ASSETID=`curl -s -X GET https://api.github.com/repos/COMBINE-lab/salmon/releases/1263754/assets | grep "\"id" | head -1 | awk '{gsub(/,$/,""); print $2}'` |
| 68 | +# |
| 69 | +## Delete the previous tarball |
| 70 | +#echo -e "Deleting previous asset\n" |
| 71 | +#curl -X DELETE -H "Authorization: token ${SALMON_PUSH_KEY}" https://api.github.com/repos/COMBINE-lab/salmon/releases/assets/$ASSETID |
| 72 | +# |
| 73 | +## Upload the new tarball |
| 74 | +#echo -e "Uploading new asset\n" |
| 75 | +#curl -X POST --data-binary "@SalmonBeta-latest_ubuntu-12.04.tar.gz" https://uploads.github.com/repos/COMBINE-lab/salmon/releases/1263754/assets?name=SalmonBeta-latest_ubuntu-12.04.tar.gz --header "Content-Type:application/gzip" -H "Authorization: token ${SALMON_PUSH_KEY}" |
| 76 | +#echo -e "Done!\n" |
0 commit comments