diff --git a/.circleci/config.yml b/.circleci/config.yml index 675e463..b24a515 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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.*/ diff --git a/Makefile b/Makefile index 8c7dcf2..fe1aab4 100644 --- a/Makefile +++ b/Makefile @@ -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 \ No newline at end of file diff --git a/scripts/package-debian.sh b/scripts/package-debian.sh new file mode 100755 index 0000000..21dace9 --- /dev/null +++ b/scripts/package-debian.sh @@ -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 diff --git a/scripts/release.sh b/scripts/release.sh deleted file mode 100755 index 15b8358..0000000 --- a/scripts/release.sh +++ /dev/null @@ -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}