chore: use date based versioning

This commit is contained in:
wpetit 2023-03-22 18:33:23 +01:00
parent cd796fff89
commit 97a60e2617
2 changed files with 10 additions and 8 deletions

View File

@ -64,7 +64,7 @@ archives:
checksum: checksum:
name_template: 'checksums.txt' name_template: 'checksums.txt'
snapshot: snapshot:
name_template: "{{ incpatch .Version }}-next" name_template: "{{ .Version }}"
changelog: changelog:
sort: asc sort: asc
filters: filters:

View File

@ -1,14 +1,16 @@
LINT_ARGS ?= --timeout 5m LINT_ARGS ?= --timeout 5m
GORELEASER_VERSION ?= v1.13.1 GORELEASER_VERSION ?= v1.13.1
GORELEASER_ARGS ?= release --auto-snapshot --snapshot --rm-dist GORELEASER_ARGS ?= release --snapshot --rm-dist
GITCHLOG_ARGS ?= GITCHLOG_ARGS ?=
SHELL := /bin/bash SHELL := /bin/bash
EMISSARY_VERSION ?= EMISSARY_VERSION ?=
GIT_VERSION ?= $(shell git describe --always) GIT_VERSION := $(shell git describe --always)
DATE_VERSION := $(shell date +%Y.%-m.%-d)
FULL_VERSION := v$(DATE_VERSION)-$(GIT_VERSION)$(if $(shell git diff --stat),-dirty,)
DOCKER_IMAGE_NAME ?= bornholm/emissary DOCKER_IMAGE_NAME ?= bornholm/emissary
DOCKER_IMAGE_TAG ?= $(GIT_VERSION)$(if $(shell git diff --stat),-dirty,) DOCKER_IMAGE_TAG ?= $(FULL_VERSION)
GOTEST_ARGS ?= -short GOTEST_ARGS ?= -short
@ -43,7 +45,7 @@ build-emissary-%: deps ## Build executable
-v \ -v \
-ldflags "\ -ldflags "\
-X 'main.GitRef=$(shell git rev-parse --short HEAD)' \ -X 'main.GitRef=$(shell git rev-parse --short HEAD)' \
-X 'main.ProjectVersion=$(shell git describe --always)' \ -X 'main.ProjectVersion=$(FULL_VERSION)' \
-X 'main.BuildDate=$(shell date --utc --rfc-3339=seconds)' \ -X 'main.BuildDate=$(shell date --utc --rfc-3339=seconds)' \
" \ " \
-o ./bin/$* \ -o ./bin/$* \
@ -73,7 +75,7 @@ dump-config: build-emissary
.PHONY: goreleaser .PHONY: goreleaser
goreleaser: deps goreleaser: deps
( set -o allexport && source .env && set +o allexport && VERSION=$(GORELEASER_VERSION) curl -sfL https://goreleaser.com/static/run | bash /dev/stdin $(GORELEASER_ARGS) ) ( set -o allexport && source .env && set +o allexport && VERSION=$(GORELEASER_VERSION) curl -sfL https://goreleaser.com/static/run | GORELEASER_CURRENT_TAG="$(FULL_VERSION)" bash /dev/stdin $(GORELEASER_ARGS) )
.PHONY: start-release .PHONY: start-release
start-release: start-release:
@ -126,8 +128,8 @@ gitea-release: tools/gitea-release/bin/gitea-release.sh goreleaser
GITEA_RELEASE_PROJECT="emissary" \ GITEA_RELEASE_PROJECT="emissary" \
GITEA_RELEASE_ORG="arcad" \ GITEA_RELEASE_ORG="arcad" \
GITEA_RELEASE_BASE_URL="https://forge.cadoles.com" \ GITEA_RELEASE_BASE_URL="https://forge.cadoles.com" \
GITEA_RELEASE_VERSION="$(GIT_VERSION)" \ GITEA_RELEASE_VERSION="$(FULL_VERSION)" \
GITEA_RELEASE_NAME="$(GIT_VERSION)" \ GITEA_RELEASE_NAME="$(FULL_VERSION)" \
GITEA_RELEASE_COMMITISH_TARGET="$(GIT_VERSION)" \ GITEA_RELEASE_COMMITISH_TARGET="$(GIT_VERSION)" \
GITEA_RELEASE_IS_DRAFT="false" \ GITEA_RELEASE_IS_DRAFT="false" \
GITEA_RELEASE_BODY="" \ GITEA_RELEASE_BODY="" \