fix: version generate
This commit is contained in:
parent
e6a79496e8
commit
8ccdd9e013
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -16,4 +16,5 @@
|
|||
|
||||
sour.is-keyproofs
|
||||
.env
|
||||
/pub
|
||||
/pub
|
||||
local.mk
|
||||
|
|
6
Makefile
6
Makefile
|
@ -3,7 +3,8 @@ BUMP?=current
|
|||
DATE:=$(shell date -u +%FT%TZ)
|
||||
HASH:=$(shell git rev-parse HEAD 2> /dev/null)
|
||||
VERSION:=$(shell BUMP=$(BUMP) ./version.sh)
|
||||
|
||||
-include local.mk
|
||||
DISABLE_VCARD=true
|
||||
|
||||
build: $(NAME)
|
||||
|
||||
|
@ -12,11 +13,14 @@ clean:
|
|||
|
||||
version:
|
||||
@echo $(VERSION)
|
||||
|
||||
tag:
|
||||
git tag -a v$(VERSION) -m "Version: $(VERSION)"
|
||||
git push --follow-tags
|
||||
|
||||
release:
|
||||
@make tag BUMP=patch
|
||||
|
||||
run:
|
||||
go run -v \
|
||||
-ldflags "\
|
||||
|
|
1
go.mod
1
go.mod
|
@ -22,6 +22,7 @@ require (
|
|||
go.uber.org/ratelimit v0.1.0
|
||||
golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9
|
||||
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect
|
||||
golang.org/x/sys v0.3.0 // indirect
|
||||
golang.org/x/text v0.3.4 // indirect
|
||||
gosrc.io/xmpp v0.5.1
|
||||
)
|
||||
|
|
2
go.sum
2
go.sum
|
@ -145,6 +145,8 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193
|
|||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.3.0 h1:w8ZOecv6NaNa/zC8944JTU3vz4u6Lagfk4RPQxv92NQ=
|
||||
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
|
|
2
main.go
2
main.go
|
@ -15,7 +15,6 @@ import (
|
|||
"github.com/rs/cors"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"gosrc.io/xmpp"
|
||||
|
||||
"github.com/sour-is/keyproofs/pkg/cache"
|
||||
"github.com/sour-is/keyproofs/pkg/config"
|
||||
|
@ -25,7 +24,6 @@ import (
|
|||
app_avatar "github.com/sour-is/keyproofs/pkg/app/avatar"
|
||||
app_dns "github.com/sour-is/keyproofs/pkg/app/dns"
|
||||
app_keyproofs "github.com/sour-is/keyproofs/pkg/app/keyproofs"
|
||||
app_vcard "github.com/sour-is/keyproofs/pkg/app/vcard"
|
||||
app_wkd "github.com/sour-is/keyproofs/pkg/app/wkd"
|
||||
)
|
||||
|
||||
|
|
18
version.sh
18
version.sh
|
@ -1,8 +1,8 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Increment a version string using Semantic Versioning (SemVer) terminology.
|
||||
|
||||
# Parse command line options.
|
||||
BUMP="${BUMP:="$1"}"
|
||||
|
||||
case $BUMP in
|
||||
current ) ;;
|
||||
|
@ -11,43 +11,43 @@ case $BUMP in
|
|||
patch ) patch=true;;
|
||||
esac
|
||||
|
||||
version=$(git describe --tags `git rev-list --tags --max-count=1 2> /dev/null` 2> /dev/null|cut -b2-)
|
||||
version=$(git describe --tags "$(git rev-list --tags --max-count=1 2> /dev/null)" 2> /dev/null|cut -b2-)
|
||||
|
||||
# Build array from version string.
|
||||
|
||||
a=( ${version//./ } )
|
||||
IFS="." read -r -a a <<< "$version"
|
||||
|
||||
# If version string is missing or has the wrong number of members, show usage message.
|
||||
|
||||
if [ ${#a[@]} -ne 3 ]
|
||||
then
|
||||
version=0.0.0
|
||||
a=( ${version//./ } )
|
||||
IFS="." read -r -a a <<< "$version"
|
||||
fi
|
||||
|
||||
# Increment version numbers as requested.
|
||||
|
||||
if [ ! -z $major ]
|
||||
if [ -n "$major" ]
|
||||
then
|
||||
((a[0]++))
|
||||
a[1]=0
|
||||
a[2]=0
|
||||
fi
|
||||
|
||||
if [ ! -z $minor ]
|
||||
if [ -n "$minor" ]
|
||||
then
|
||||
((a[1]++))
|
||||
a[2]=0
|
||||
fi
|
||||
|
||||
if [ ! -z $patch ]
|
||||
if [ -n "$patch" ]
|
||||
then
|
||||
((a[2]++))
|
||||
fi
|
||||
|
||||
if git status --porcelain >/dev/null
|
||||
then
|
||||
echo "${a[0]}.${a[1]}.${a[2]}"
|
||||
echo "v${a[0]}.${a[1]}.${a[2]}"
|
||||
else
|
||||
echo "${a[0]}.${a[1]}.${a[2]}-dirty"
|
||||
echo "v${a[0]}.${a[1]}.${a[2]}-dirty"
|
||||
fi
|
Loading…
Reference in New Issue
Block a user