Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
build binaries for the latest release tag
Browse files Browse the repository at this point in the history
  • Loading branch information
littleskunk committed Jun 26, 2017
1 parent 322f3e7 commit f87b48a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 26 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ Autobin creates a draft release for every open pull request and deletes the rele

### Draft a new release

Create a new release with the name "autobin draft release". Select base branch and release tag and save it as draft release. You can add a release discription any time. Autobin will build and upload binaries based on the selected branch and release tag. Be carefull with new commits. You have to delete the old binaries yourself to get new binaries.

Rename the release to detach the build scripts. There you have the new release ready to publish.
Create a new release with a release tag. Autobin will build binaries for the latest draft or published release. It will ignore releases without a release tag. Be carefull with new commits. You have to delete the old binaries yourself to get new binaries.

Setup
=====
Expand Down
31 changes: 8 additions & 23 deletions storjshare-gui/build-linux-binary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@ tags=$(curl -H "Accept: application/json" -H "Authorization: token $GH_TOKEN" $t

for ((j=0; j < $(echo $releases | jq ". | length"); j++)); do

releasename=$(echo $releases | jq --raw-output ".[$j].name")
releasetag=$(echo $releases | jq --raw-output ".[$j].tag_name")

if [ "$releasename" = "autobin draft release" ]; then
if [ "$releasetag" != "null" ]; then
assetfound=false
asseturl=$(echo $releases | jq --raw-output ".[$j].assets_url")
assets=$(curl -H "Accept: application/json" -H "Authorization: token $GH_TOKEN" $asseturl)
for ((k=0; k < $(echo $assets | jq ". | length"); k++)); do

assetname=$(echo $assets | jq --raw-output ".[$k].name")

if [ "${assetname: -10}" = ".$arch.deb" ]; then
if [ "${assetname: 14}" = ".$arch.deb" ]; then
assetstate=$(echo $assets | jq --raw-output ".[$k].state")
if [ "$assetstate" = "new" ]; then
binaryurl=$(echo $assets | jq --raw-output ".[$k].url")
Expand All @@ -47,33 +46,16 @@ for ((j=0; j < $(echo $releases | jq ". | length"); j++)); do
uploadurl=$(echo $releases | jq --raw-output ".[$j].upload_url")
uploadurl=${uploadurl//\{?name,label\}/}

# existing build tag or branch
targetbranch=$(echo $releases | jq --raw-output ".[$j].target_commitish")
targettag=$(echo $releases | jq --raw-output ".[$j].tag_name")
if [ "$targettag" != "null" ]; then
for ((l=0; l < $(echo $tags | jq ". | length"); l++)); do
tag=$(echo $tags | jq --raw-output ".[$l].name")
if [ "$targettag" = "$tag" ]; then
targetbranch=$targettag
fi
done
fi

cd "$workdir"
mkdir repos
cd repos

rm -rf $repositoryname

echo create and upload binary $repositoryurl $targetbranch
git clone $repositoryurl -b $targetbranch $repositoryname
echo create and upload binary $repositoryurl $releasetag
git clone $repositoryurl -b $releasetag $repositoryname
cd $repositoryname

# run script as root
#npm install --unsafe-perm
#npm run release --unsafe-perm

# run script as normal user
npm install
npm run release
cd releases
Expand All @@ -82,6 +64,9 @@ for ((j=0; j < $(echo $releases | jq ". | length"); j++)); do
curl -H "Accept: application/json" -H "Content-Type: application/octet-stream" -H "Authorization: token $GH_TOKEN" --data-binary "@$filename" "$uploadurl?name=$filename"
cd "$workdir"
fi

# don't build binaries for old release tags
break
fi
done

Expand Down

0 comments on commit f87b48a

Please sign in to comment.