diff options
author | Tulir Asokan <tulir@maunium.net> | 2018-05-15 19:48:19 +0300 |
---|---|---|
committer | Tulir Asokan <tulir@maunium.net> | 2018-05-15 19:56:43 +0300 |
commit | 2b72945490de9df32369f7c55bc96199aaf3a73d (patch) | |
tree | 3496865a8e6241ce4d00ac3b1a2331a2e4e40813 /scripts | |
parent | cb3a6e764e3bd9023986bbce22ea971e7aa0a9d9 (diff) |
Add gh-deployer
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/ci | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/scripts/ci b/scripts/ci new file mode 100755 index 0000000..83d65d9 --- /dev/null +++ b/scripts/ci @@ -0,0 +1,24 @@ +#!/bin/bash +mkdir -p .tmp/src/maunium.net/go +ln -s ../../../../ .tmp/src/maunium.net/go/gomuks +mkdir -p target/ +export GOPATH=$(pwd)/.tmp +export SHORTHEAD=${HEAD:0:7} +export VERSION=$(awk '/^Version:/ { print $2 }' deb/DEBIAN/control | sed -E 's/\-[0-9]+$//') + +echo "Compiling for linux/amd64" +go build -o "target/$PROJECT_NAME-linux-amd64" +echo "Compiling for linux/arm" +GOARCH=arm go build -o "target/$PROJECT_NAME-linux-arm" +echo "Compiling for darwin/amd64" +GOOS=darwin go build -o "target/$PROJECT_NAME-darwin-amd64" + +echo "Packaging for debian (linux/amd64)" +mkdir -p deb/usr/bin/ +cp target/$PROJECT_NAME-linux-amd64 deb/usr/bin/gomuks +sed -i.bak -E 's/(Version: [0-9]+\.[0-9]+\.[0-9]+\-[0-9]+)/\1+'$SHORTHEAD'/' deb/DEBIAN/control +dpkg-deb --build deb 'target/'$PROJECT_NAME'_linux_amd64.deb' +mv -f deb/DEBIAN/control.bak deb/DEBIAN/control + +mkdir -p /srv/downloads/programs/gomuks/$VERSION-$SHORTHEAD +mv target/* /srv/downloads/programs/gomuks/$VERSION-$SHORTHEAD/ |