mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
🤖 Improve build version population based on git branch (#39523)
For #39522. Guessing this doesn't resolve goreleaser issues though? Tested with this branch (shows a snapshot), `4.77.9-plus-sparklies`, `v4.77.12-without-sparkles`, and `rc-patch-fleet-v4.77.7` locally to make sure this behaves properly. # Checklist for submitter If some of the following don't apply, delete the relevant line. - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. - [x] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements) ## Testing - [x] QA'd all new/changed functionality manually --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: iansltx <472804+iansltx@users.noreply.github.com>
This commit is contained in:
parent
5ac8deeccf
commit
2b5eedac5e
2 changed files with 15 additions and 1 deletions
15
Makefile
15
Makefile
|
|
@ -3,8 +3,21 @@
|
|||
export GO111MODULE=on
|
||||
|
||||
PATH := $(shell npm bin):$(PATH)
|
||||
VERSION = $(shell git describe --tags --always --dirty)
|
||||
BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
# If VERSION is not explicitly set, check for version patterns in branch name
|
||||
ifndef VERSION
|
||||
# 1. rc-minor-fleet-vX.Y.Z or rc-patch-fleet-vX.Y.Z → X.Y.Z-rc.YYMMDDhhmm
|
||||
VERSION := $(shell echo "$(BRANCH)" | sed -E -n "s/^rc-(minor|patch)-fleet-v([0-9]+\.[0-9]+\.[0-9]+).*/\2-rc.$$(date -u +'%y%m%d%H%M')/p")
|
||||
ifeq ($(VERSION),)
|
||||
# 2. X.Y.Z-anything or vX.Y.Z-anything → X.Y.Z+YYMMDDhhmm
|
||||
VERSION := $(shell echo "$(BRANCH)" | sed -E -n "s/^v?([0-9]+\.[0-9]+\.[0-9]+)[-+].*/\1+$$(date -u +'%y%m%d%H%M')/p")
|
||||
endif
|
||||
# 3. Otherwise fall back to git describe
|
||||
ifeq ($(VERSION),)
|
||||
VERSION := $(shell git describe --tags --always --dirty)
|
||||
endif
|
||||
endif
|
||||
REVISION = $(shell git rev-parse HEAD)
|
||||
REVSHORT = $(shell git rev-parse --short HEAD)
|
||||
USER = $(shell whoami)
|
||||
|
|
|
|||
1
changes/39522-build-workflow
Normal file
1
changes/39522-build-workflow
Normal file
|
|
@ -0,0 +1 @@
|
|||
* Added automatic tagging of prerelease/post-release versions on local build based on branch name
|
||||
Loading…
Reference in a new issue