gomuks/scripts/ci

40 lines
1.3 KiB
Plaintext
Raw Normal View History

2018-05-15 18:48:19 +02:00
#!/bin/bash
2019-01-11 23:22:51 +01:00
mkdir -p ../.gopath
mkdir -p target
mkdir -p .tmp
export GOPATH=$(dirname $(pwd))/.gopath
2018-05-15 18:48:19 +02:00
export SHORTHEAD=${HEAD:0:7}
export VERSION=$(awk '/^Version:/ { print $2 }' deb/DEBIAN/control | sed -E 's/\-[0-9]+$//')
2019-01-11 23:22:51 +01:00
export CGO_ENABLED=0
2018-05-15 18:48:19 +02:00
echo "Compiling for linux/amd64"
go build -o "target/$PROJECT_NAME-linux-amd64"
2019-01-11 22:48:59 +01:00
echo "Compiling for linux/386"
GOARCH=386 go build -o "target/$PROJECT_NAME-linux-386"
2018-05-15 18:48:19 +02:00
echo "Compiling for linux/arm"
GOARCH=arm go build -o "target/$PROJECT_NAME-linux-arm"
2019-01-11 22:48:59 +01:00
echo "Compiling for linux/arm64"
GOARCH=arm64 go build -o "target/$PROJECT_NAME-linux-arm64"
2018-05-15 18:48:19 +02:00
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/
2018-05-15 18:48:19 +02:00
cp target/$PROJECT_NAME-linux-amd64 deb/usr/bin/gomuks
2019-01-11 23:22:51 +01:00
git clone https://github.com/tulir/tcell.git .tmp/tcell
mkdir -p deb/usr/share/tcell/
rm -rf deb/usr/share/tcell/database
2019-01-11 23:35:42 +01:00
cp -r .tmp/tcell/terminfo/database deb/usr/share/tcell
2018-05-15 18:48:19 +02:00
sed -i.bak -E 's/(Version: [0-9]+\.[0-9]+\.[0-9]+\-[0-9]+)/\1+'$SHORTHEAD'/' deb/DEBIAN/control
2019-01-11 23:35:42 +01:00
chmod -R -s deb/DEBIAN
chmod -R 0755 deb/DEBIAN
2018-05-15 18:48:19 +02:00
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/