Add .deb for debian/ubuntu

This commit is contained in:
Liam Galvin 2018-11-25 16:59:44 +00:00
parent 7da69c342c
commit 00b78df336
4 changed files with 60 additions and 30 deletions

View File

@ -24,6 +24,19 @@ jobs:
root: bin
paths:
- linux
package-debian:
docker:
- image: liamg/golang-opengl
working_directory: /go/src/github.com/liamg/aminal
requires:
- build
steps:
- checkout
- run: make package-debian
- persist_to_workspace:
root: bin
paths:
- debian
build-darwin:
docker:
- image: karalabe/xgo-latest:latest
@ -49,6 +62,7 @@ jobs:
mkdir -p release
cp artifacts/linux/* release/
cp artifacts/darwin/* release/
cp artifacts/debian/* release/
go get github.com/tcnksm/ghr
ghr -t ${GITHUB_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -n "Aminal ${CIRCLE_TAG}" -b "Aminal ${CIRCLE_TAG}" -delete ${CIRCLE_TAG} release/
workflows:
@ -71,10 +85,17 @@ workflows:
filters:
tags:
only: /^v.*/
- package-debian:
requires:
- test
filters:
tags:
only: /^v.*/
- release:
requires:
- build-linux
- build-darwin
- package-debian
filters:
tags:
only: /^v.*/

View File

@ -36,3 +36,7 @@ build-linux:
build-darwin:
mkdir -p bin/darwin
xgo -x -v -ldflags "-X main.Version='${CIRCLE_TAG}'" --targets=darwin/amd64 -out bin/darwin/${BINARY} .
.PHONY: package-debian
package-debian: build-linux
./scripts/package-debian.sh "${CIRCLE_TAG}" bin/linux/${BINARY}-linux-amd64

35
scripts/package-debian.sh Executable file
View File

@ -0,0 +1,35 @@
#!/bin/bash
set -e
VERSION=${1//v}
BINARYFILE=$2
if [[ "$VERSION" == "" ]]; then
echo "No version specified"
exit 1
fi
if [[ "$BINARYFILE" == "" ]]; then
echo "No path to binary specified"
exit 1
fi
rm -rf package
mkdir -p package/DEBIAN
mkdir -p package/usr/local/bin/
cp $BINARYFILE package/usr/local/bin/aminal
chmod +x package/usr/local/bin/aminal
cat > package/DEBIAN/control <<- EOM
Package: aminal
Version: $VERSION
Maintainer: Liam Galvin
Architecture: amd64
Description: A Modern Terminal Emulator
EOM
dpkg-deb --build package
rm -rf package
mkdir -p bin/debian
mv package.deb bin/debian/${BINARYFILE}.deb

View File

@ -1,30 +0,0 @@
#!/bin/bash
set -e
git tag "${VERSION}"
git push origin "${VERSION}"
github-release release \
--user liamg \
--repo aminal \
--tag "${VERSION}" \
--name "Aminal ${VERSION}"
github-release upload \
--user liamg \
--repo aminal \
--tag "${VERSION}" \
--name "${BINARY}-osx-amd64" \
--file release/bin/darwin/amd64/${BINARY}
github-release upload \
--user liamg \
--repo aminal \
--tag "${VERSION}" \
--name "${BINARY}-linux-amd64" \
--file release/bin/linux/amd64/${BINARY}
github-release upload \
--user liamg \
--repo aminal \
--tag "${VERSION}" \
--name "${BINARY}-linux-386" \
--file release/bin/linux/386/${BINARY}