fix: version generate

This commit is contained in:
Jon Lundy 2023-01-06 13:30:33 -07:00
parent e6a79496e8
commit 8ccdd9e013
Signed by untrusted user who does not match committer: xuu
GPG Key ID: C63E6D61F3035024
6 changed files with 19 additions and 13 deletions

3
.gitignore vendored
View File

@ -16,4 +16,5 @@
sour.is-keyproofs sour.is-keyproofs
.env .env
/pub /pub
local.mk

View File

@ -3,7 +3,8 @@ BUMP?=current
DATE:=$(shell date -u +%FT%TZ) DATE:=$(shell date -u +%FT%TZ)
HASH:=$(shell git rev-parse HEAD 2> /dev/null) HASH:=$(shell git rev-parse HEAD 2> /dev/null)
VERSION:=$(shell BUMP=$(BUMP) ./version.sh) VERSION:=$(shell BUMP=$(BUMP) ./version.sh)
-include local.mk
DISABLE_VCARD=true
build: $(NAME) build: $(NAME)
@ -12,11 +13,14 @@ clean:
version: version:
@echo $(VERSION) @echo $(VERSION)
tag: tag:
git tag -a v$(VERSION) -m "Version: $(VERSION)" git tag -a v$(VERSION) -m "Version: $(VERSION)"
git push --follow-tags git push --follow-tags
release: release:
@make tag BUMP=patch @make tag BUMP=patch
run: run:
go run -v \ go run -v \
-ldflags "\ -ldflags "\

1
go.mod
View File

@ -22,6 +22,7 @@ require (
go.uber.org/ratelimit v0.1.0 go.uber.org/ratelimit v0.1.0
golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9 golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9
golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect 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 golang.org/x/text v0.3.4 // indirect
gosrc.io/xmpp v0.5.1 gosrc.io/xmpp v0.5.1
) )

2
go.sum
View File

@ -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-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 h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 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/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.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=

View File

@ -15,7 +15,6 @@ import (
"github.com/rs/cors" "github.com/rs/cors"
"github.com/rs/zerolog" "github.com/rs/zerolog"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
"gosrc.io/xmpp"
"github.com/sour-is/keyproofs/pkg/cache" "github.com/sour-is/keyproofs/pkg/cache"
"github.com/sour-is/keyproofs/pkg/config" "github.com/sour-is/keyproofs/pkg/config"
@ -25,7 +24,6 @@ import (
app_avatar "github.com/sour-is/keyproofs/pkg/app/avatar" app_avatar "github.com/sour-is/keyproofs/pkg/app/avatar"
app_dns "github.com/sour-is/keyproofs/pkg/app/dns" app_dns "github.com/sour-is/keyproofs/pkg/app/dns"
app_keyproofs "github.com/sour-is/keyproofs/pkg/app/keyproofs" 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" app_wkd "github.com/sour-is/keyproofs/pkg/app/wkd"
) )

View File

@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
# Increment a version string using Semantic Versioning (SemVer) terminology. # Increment a version string using Semantic Versioning (SemVer) terminology.
# Parse command line options. # Parse command line options.
BUMP="${BUMP:="$1"}"
case $BUMP in case $BUMP in
current ) ;; current ) ;;
@ -11,43 +11,43 @@ case $BUMP in
patch ) patch=true;; patch ) patch=true;;
esac 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. # 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 version string is missing or has the wrong number of members, show usage message.
if [ ${#a[@]} -ne 3 ] if [ ${#a[@]} -ne 3 ]
then then
version=0.0.0 version=0.0.0
a=( ${version//./ } ) IFS="." read -r -a a <<< "$version"
fi fi
# Increment version numbers as requested. # Increment version numbers as requested.
if [ ! -z $major ] if [ -n "$major" ]
then then
((a[0]++)) ((a[0]++))
a[1]=0 a[1]=0
a[2]=0 a[2]=0
fi fi
if [ ! -z $minor ] if [ -n "$minor" ]
then then
((a[1]++)) ((a[1]++))
a[2]=0 a[2]=0
fi fi
if [ ! -z $patch ] if [ -n "$patch" ]
then then
((a[2]++)) ((a[2]++))
fi fi
if git status --porcelain >/dev/null if git status --porcelain >/dev/null
then then
echo "${a[0]}.${a[1]}.${a[2]}" echo "v${a[0]}.${a[1]}.${a[2]}"
else else
echo "${a[0]}.${a[1]}.${a[2]}-dirty" echo "v${a[0]}.${a[1]}.${a[2]}-dirty"
fi fi