-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat[gihub] add make github_release command
- Loading branch information
Showing
3 changed files
with
40 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
.PHONY: github_release | ||
|
||
docker_build: | ||
docker build -t aviasales/burlesque --force-rm --no-cache . | ||
docker build -t aviasales/burlesque:latest --force-rm --no-cache . | ||
|
||
docker_run: | ||
docker run --rm -p 4001:4001 aviasales/burlesque | ||
docker run --rm -p 4001:4001 aviasales/burlesque:latest | ||
|
||
docker_tty: | ||
docker run --rm -p 4001:4001 -v `pwd`:/src/github.com/KosyanMedia/burlesque -ti aviasales/burlesque /bin/bash | ||
docker run --rm -p 4001:4001 -v `pwd`:/src/github.com/KosyanMedia/burlesque -ti aviasales/burlesque:latest /bin/bash | ||
|
||
github_release: | ||
docker run --rm -v `pwd`:/src/github.com/KosyanMedia/burlesque aviasales/burlesque:latest /bin/bash -c "TAG=$(TAG) TOKEN=$(TOKEN) ./utils/github_release.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
# Example of use: | ||
# TAG=v1.2 TOKEN=447879c5af5887eab22725605783e86d3304bc99 bash ./github_release.sh | ||
|
||
if [ -z "$TAG" ]; then | ||
echo "TAG is empty please do 'export TAG=v0.1' for example" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$TOKEN" ]; then | ||
echo "You forgot write yout TOKEN" | ||
exit 1 | ||
fi | ||
|
||
LINUX_BIN_PATH=/bin/burlesque | ||
|
||
gzip -9 -f $LINUX_BIN_PATH || exit 1 | ||
|
||
response=`curl --data "{\\"tag_name\\": \\"$TAG\\",\\"target_commitish\\": \\"master\\",\\"name\\": \\"$TAG\\",\\"body\\": \\"Release of version $TAG\\", \\"draft\\": false,\\"prerelease\\": false}" \ | ||
-H 'Accept-Encoding: gzip,deflate' --compressed "https://api.github.com/repos/KosyanMedia/burlesque/releases?access_token=$TOKEN" > response` | ||
|
||
release_id=`cat response|head -n 10|grep '"id"'|head -n 1|awk '{print $2}'|sed -e 's/,//'` | ||
rm response | ||
|
||
if [ -z "$release_id" ]; then | ||
echo "something wrong" | ||
echo $response | ||
exit 1 | ||
fi | ||
|
||
curl -X POST -H 'Content-Type: application/x-gzip' --data-binary @$LINUX_BIN_PATH.gz "https://uploads.github.com/repos/KosyanMedia/burlesque/releases/$release_id/assets?name=burlesque.gz&access_token=$TOKEN" |