chore(): add linux arm and darwin binaries

This commit is contained in:
Nicolas Carlier 2018-01-10 16:43:38 +00:00
parent 7154828eca
commit faf5da7a33
3 changed files with 43 additions and 6 deletions

View File

@ -1,11 +1,20 @@
language: go
go:
- 1.8
script:
- GOARCH=amd64 make
- GOARCH=arm64 make
- GOARCH=arm make
- GOOS=darwin make
deploy:
provider: releases
api_key:
secure: VATbHmgR1DDXlIHEMpupuTggPU6wgtZk3BFK/eT5L+qqhnfSal1z+ZsypgWMGZN2Ch6WTRFaXqUhpV7N2oo+pQoXAYcDFWTd3BiTUied+pKVoUa8VuZFF2TW1cNcVJ3fnFPMFnpJPTYkld//+8s8zJQitTabE1QZdXNYPU1uUiY=
file: release/webhookd-linux-amd64
file:
- release/webhookd-linux-amd64
- release/webhookd-linux-arm64
- release/webhookd-linux-arm
- release/webhookd-darwin-amd64
skip_cleanup: true
on:
repo: ncarlier/webhookd

View File

@ -16,7 +16,7 @@ $ go get -v github.com/ncarlier/webhookd/webhookd
**Or** download the binary regarding your architecture:
```bash
$ sudo curl -s https://raw.githubusercontent.com/ncarlier/webhookd/master/install.sh | sh
$ sudo curl -s https://raw.githubusercontent.com/ncarlier/webhookd/master/install.sh | bash
```
**Or** use Docker:

View File

@ -1,8 +1,36 @@
#!/bin/sh
#!/bin/bash
die() { echo "error: $@" 1>&2 ; exit 1; }
# Getting operating system
os=`uname -s`
os=${os,,}
# Getting architecture
arch=`uname -m`
case "$arch" in
"armv7l")
arch="arm"
;;
"x86_64")
arch="amd64"
;;
esac
release_url="https://api.github.com/repos/ncarlier/webhookd/releases/latest"
download_url=`curl -s $release_url | grep browser_download_url | head -n 1 | cut -d '"' -f 4`
artefact_url=`curl -s $release_url | grep browser_download_url | head -n 1 | cut -d '"' -f 4`
[ -z "$artefact_url" ] && die "Unable to extract artefact URL"
base_download_url=`dirname $artefact_url`
sudo curl -o /usr/local/bin/webhookd -L $download_url
sudo chmod +x /usr/local/bin/webhookd
download_url=$base_download_url/webhookd-$os-$arch
bin_target=/usr/local/bin/webhookd
echo "Downloading $download_url to $bin_target ..."
sudo curl -o $bin_target --fail -L $download_url
[ $? != 0 ] && die "Unable download binary for your architecture."
echo "Making $bin_target as executable ..."
sudo chmod +x $bin_target
[ $? != 0 ] && die "Unable to make the binary as executable."
echo "Installation done. Type 'webhookd' to start the server."