release version 2.4.1

This commit is contained in:
Xuu 2020-08-28 17:23:12 -06:00
parent 4659727d3a
commit 220be8f732
Signed by: xuu
GPG Key ID: 8B3B0604F164E04F
4 changed files with 71 additions and 18 deletions

View File

@ -4,6 +4,9 @@ DOCS_ASSET=src/docs/bindata.go
SOURCE=$(wildcard cmd/paste/*.go) $(filter-out src/routes/bindata.go, $(wildcard src/routes/*.go))
BINARY=paste
VERSION:=$(shell debian/inc_version.sh -p $(shell git describe --tags `git rev-list --tags --max-count=1`))
DATE:=$(shell date -u +%FT%TZ)
define DUMMY_BINDATA
package docs
import "net/http"
@ -27,8 +30,9 @@ run: $(BINARY)
./$(BINARY) -vv serve
$(BINARY): $(SOURCE) $(ROUTE_ASSET) $(DOCS_ASSET)
go build "sour.is/x/paste/cmd/paste"
go build \
-ldflags "-X main.AppVersion=$(VERSION) -X main.AppBuild=$(DATE)" \
"sour.is/x/paste/cmd/paste"
clean-ui:
rm -rf $(ROUTE_ASSET) $(DOCS_ASSET)

28
debian/Makefile vendored
View File

@ -1,42 +1,40 @@
NAME=sour.is-paste
VERSION:=$(shell cat VERSION)
RELEASE:=$(shell cat RELEASE)
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)
REPO_HOST="xuu@kapha"
ANSIBLE_HOST="kapha"
REPO_PATH="/opt/web/pub/sour.is/debian/"
all: release build copy
all: build copy tag
clean:
rm -r BUILD/*
release:
@echo "release version $(RELEASE)"
@echo `expr $(RELEASE) + 1` > RELEASE
git commit -am "release version $(VERSION)-$(RELEASE)"
git tag -a -m "release version $(VERSION)-$(RELEASE)" "v$(VERSION)-$(RELEASE)"
tag:
git commit -am "release version $(VERSION)"
git tag -a -m "release version $(VERSION)" "v$(VERSION)"
git push --tags
build:
export BUILD="BUILD/$(NAME)_$(VERSION)-$(RELEASE)"; \
export BUILD="BUILD/$(NAME)_$(VERSION)"; \
rm -rf ./$${BUILD}; \
cp -r ROOT "$${BUILD}"; \
sed -i'.tmp' "s_Version:.*_Version: $(VERSION)-$(RELEASE)_" "$${BUILD}/DEBIAN/control"
sed -i'.tmp' "s_Version:.*_Version: $(VERSION)_" "$${BUILD}/DEBIAN/control"
export DATE=`date -u +%FT%TZ`; \
export BUILD="BUILD/$(NAME)_$(VERSION)-$(RELEASE)"; \
export BUILD="BUILD/$(NAME)_$(VERSION)"; \
env GOOS=linux GOARCH=amd64 go build -v -o $${BUILD}/opt/sour.is/bin/paste \
-ldflags "-X main.AppVersion=$(VERSION)-$(RELEASE) -X main.AppBuild=$${DATE}"\
-ldflags "-X main.AppVersion=$(VERSION) -X main.AppBuild=$(DATE)"\
sour.is/x/paste/cmd/paste; \
dpkg -b $${BUILD};
copy:
export BUILD="BUILD/$(NAME)_$(VERSION)-$(RELEASE)"; \
export BUILD="BUILD/$(NAME)_$(VERSION)"; \
scp "$${BUILD}.deb" $(REPO_HOST):$(REPO_PATH); \
ssh $(REPO_HOST) -- $(REPO_PATH)scan.sh "$(REPO_PATH)$(NAME)_$(VERSION)-$(RELEASE).deb";
ssh $(REPO_HOST) -- $(REPO_PATH)scan.sh "$(REPO_PATH)$(NAME)_$(VERSION).deb";
deploy:
ansible $(ANSIBLE_HOST) -u xuu -b -m apt -a "name=sour.is-paste update_cache=yes state=latest"
.PHONY: clean release build copy # deploy
.PHONY: clean tag build copy deploy

1
debian/RELEASE vendored
View File

@ -1 +0,0 @@
19

52
debian/inc_version.sh vendored Executable file
View File

@ -0,0 +1,52 @@
#!/bin/bash
# Increment a version string using Semantic Versioning (SemVer) terminology.
# Parse command line options.
while getopts ":Mmp" Option
do
case $Option in
M ) major=true;;
m ) minor=true;;
p ) patch=true;;
esac
done
shift $(($OPTIND - 1))
version=$1
# Build array from version string.
a=( ${version//./ } )
# If version string is missing or has the wrong number of members, show usage message.
if [ ${#a[@]} -ne 3 ]
then
>&2 echo "usage: $(basename $0) [-Mmp] major.minor.patch"
exit 1
fi
# Increment version numbers as requested.
if [ ! -z $major ]
then
((a[0]++))
a[1]=0
a[2]=0
fi
if [ ! -z $minor ]
then
((a[1]++))
a[2]=0
fi
if [ ! -z $patch ]
then
((a[2]++))
fi
echo "${a[0]}.${a[1]}.${a[2]}"