Readd Makefile
This commit is contained in:
parent
e2c26cd7ac
commit
f5595236ec
37
Makefile
Normal file
37
Makefile
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# builds .rpm and .deb packages
|
||||||
|
# requires dockerd to be running
|
||||||
|
# builds the packages for amd64
|
||||||
|
|
||||||
|
VERSION=$(shell go run main.go -v)
|
||||||
|
ARCHIVE="gotop_$(VERSION)_linux_amd64"
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
all: dist/gotop.rpm dist/gotop.deb
|
||||||
|
|
||||||
|
dist/gotop:
|
||||||
|
@GOOS=linux GOARCH=amd64 go build -o $@
|
||||||
|
|
||||||
|
dist:
|
||||||
|
@mkdir $@
|
||||||
|
|
||||||
|
dist/gotop.rpm: dist dist/gotop
|
||||||
|
@docker run --rm \
|
||||||
|
-v "$(PWD)/build:/tmp/build" \
|
||||||
|
-v "$(PWD)/dist:/tmp/dist" \
|
||||||
|
-e "VERSION=$(VERSION)" \
|
||||||
|
goreleaser/nfpm pkg \
|
||||||
|
--config /tmp/build/nfpm.yml \
|
||||||
|
--target /tmp/dist/$(ARCHIVE).rpm
|
||||||
|
|
||||||
|
dist/gotop.deb: dist dist/gotop
|
||||||
|
@docker run --rm \
|
||||||
|
-v "$(PWD)/build:/tmp/build" \
|
||||||
|
-v "$(PWD)/dist:/tmp/dist" \
|
||||||
|
-e "VERSION=$(VERSION)" \
|
||||||
|
goreleaser/nfpm pkg \
|
||||||
|
--config /tmp/build/nfpm.yml \
|
||||||
|
--target /tmp/dist/$(ARCHIVE).deb
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
@-rm -rf dist
|
|
@ -12,4 +12,4 @@ homepage: "https://github.com/cjbassi/gotop"
|
||||||
license: "GNU Affero General Public License v3.0"
|
license: "GNU Affero General Public License v3.0"
|
||||||
bindir: "/usr/local/bin"
|
bindir: "/usr/local/bin"
|
||||||
files:
|
files:
|
||||||
/tmp/pkg/gotop: "/usr/local/bin/gotop"
|
/tmp/dist/gotop: "/usr/local/bin/gotop"
|
15
ci/script.sh
15
ci/script.sh
|
@ -23,19 +23,8 @@ fi
|
||||||
tar -czf dist/${FILE}.tgz ${NAME} || ERROR=true
|
tar -czf dist/${FILE}.tgz ${NAME} || ERROR=true
|
||||||
|
|
||||||
if [[ ${GOOS} == "linux" && ${GOARCH} == "amd64" ]]; then
|
if [[ ${GOOS} == "linux" && ${GOARCH} == "amd64" ]]; then
|
||||||
VERSION=$(go run main.go -v) # used by nfpm
|
make all || ERROR=true
|
||||||
docker run --rm \
|
rm dist/gotop
|
||||||
-v $PWD:/tmp/pkg \
|
|
||||||
-e VERSION=${VERSION} \
|
|
||||||
goreleaser/nfpm pkg \
|
|
||||||
--config /tmp/pkg/ci/nfpm.yml \
|
|
||||||
--target /tmp/pkg/dist/${FILE}.deb || ERROR=true
|
|
||||||
docker run --rm \
|
|
||||||
-v $PWD:/tmp/pkg \
|
|
||||||
-e VERSION=${VERSION} \
|
|
||||||
goreleaser/nfpm pkg \
|
|
||||||
--config /tmp/pkg/ci/nfpm.yml \
|
|
||||||
--target /tmp/pkg/dist/${FILE}.rpm || ERROR=true
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ${ERROR} == "true" ]; then
|
if [ ${ERROR} == "true" ]; then
|
||||||
|
|
Loading…
Reference in New Issue
Block a user