2017-04-24 09:20:46 -06:00
|
|
|
NAME=sour.is-paste
|
2020-08-28 17:23:12 -06:00
|
|
|
VERSION:=$(shell ./inc_version.sh -p $(shell git describe --tags `git rev-list --tags --max-count=1`)|cut -b2-)
|
|
|
|
DATE:=$(shell date -u +%FT%TZ)
|
2017-04-24 09:20:46 -06:00
|
|
|
|
2020-08-17 12:40:32 -06:00
|
|
|
REPO_HOST="xuu@kapha"
|
2020-08-17 12:47:37 -06:00
|
|
|
ANSIBLE_HOST="kapha"
|
2017-04-24 09:20:46 -06:00
|
|
|
REPO_PATH="/opt/web/pub/sour.is/debian/"
|
|
|
|
|
2020-08-28 17:23:12 -06:00
|
|
|
all: build copy tag
|
2017-04-24 09:20:46 -06:00
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -r BUILD/*
|
|
|
|
|
2020-08-28 17:23:12 -06:00
|
|
|
tag:
|
|
|
|
git commit -am "release version $(VERSION)"
|
|
|
|
git tag -a -m "release version $(VERSION)" "v$(VERSION)"
|
2020-08-17 09:40:10 -06:00
|
|
|
git push --tags
|
2017-04-24 09:20:46 -06:00
|
|
|
|
|
|
|
build:
|
2020-08-28 17:23:12 -06:00
|
|
|
export BUILD="BUILD/$(NAME)_$(VERSION)"; \
|
2017-04-24 09:20:46 -06:00
|
|
|
rm -rf ./$${BUILD}; \
|
|
|
|
cp -r ROOT "$${BUILD}"; \
|
2020-08-28 17:23:12 -06:00
|
|
|
sed -i'.tmp' "s_Version:.*_Version: $(VERSION)_" "$${BUILD}/DEBIAN/control"
|
2018-03-13 16:25:18 -06:00
|
|
|
|
2020-08-17 09:40:10 -06:00
|
|
|
export DATE=`date -u +%FT%TZ`; \
|
2020-08-28 17:23:12 -06:00
|
|
|
export BUILD="BUILD/$(NAME)_$(VERSION)"; \
|
2020-08-17 09:40:10 -06:00
|
|
|
env GOOS=linux GOARCH=amd64 go build -v -o $${BUILD}/opt/sour.is/bin/paste \
|
2020-08-28 17:23:12 -06:00
|
|
|
-ldflags "-X main.AppVersion=$(VERSION) -X main.AppBuild=$(DATE)"\
|
2020-08-17 09:40:10 -06:00
|
|
|
sour.is/x/paste/cmd/paste; \
|
2018-03-23 17:07:31 -06:00
|
|
|
dpkg -b $${BUILD};
|
2017-04-24 09:20:46 -06:00
|
|
|
|
|
|
|
copy:
|
2020-08-28 17:23:12 -06:00
|
|
|
export BUILD="BUILD/$(NAME)_$(VERSION)"; \
|
2018-02-15 09:11:52 -07:00
|
|
|
scp "$${BUILD}.deb" $(REPO_HOST):$(REPO_PATH); \
|
2020-08-28 17:23:12 -06:00
|
|
|
ssh $(REPO_HOST) -- $(REPO_PATH)scan.sh "$(REPO_PATH)$(NAME)_$(VERSION).deb";
|
2017-04-24 09:20:46 -06:00
|
|
|
|
|
|
|
deploy:
|
2020-08-17 12:52:42 -06:00
|
|
|
ansible $(ANSIBLE_HOST) -u xuu -b -m apt -a "name=sour.is-paste update_cache=yes state=latest"
|
2018-03-13 16:25:18 -06:00
|
|
|
|
2020-08-28 17:23:12 -06:00
|
|
|
.PHONY: clean tag build copy deploy
|