Skip to content

Commit eebce17

Browse files
Merge pull request #788 from Nordix/improve-release-automation/furkat
🌱 Improve release automation process
2 parents 563e40a + 16ad35c commit eebce17

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.github/workflows/release.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ name: release
88

99
jobs:
1010
build:
11+
name: tag release
1112
runs-on: ubuntu-latest
1213
steps:
1314
- name: Export RELEASE_TAG var
@@ -28,4 +29,4 @@ jobs:
2829
with:
2930
draft: true
3031
files: out/*
31-
body_path: releasenotes/releasenotes.md
32+
body_path: releasenotes/${{ env.RELEASE_TAG }}.md

Makefile

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,10 +455,15 @@ delete-examples:
455455
## Release
456456
## --------------------------------------
457457

458+
## latest git tag for the commit, e.g., v1.2.1
458459
RELEASE_TAG ?= $(shell git describe --abbrev=0 2>/dev/null)
460+
ifneq (,$(findstring -,$(RELEASE_TAG)))
461+
PRE_RELEASE=true
462+
endif
463+
# the previous release tag, e.g., v1.2.0, excluding pre-release tags
464+
PREVIOUS_TAG ?= $(shell git tag -l | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+$$" | sort -V | grep -B1 $(RELEASE_TAG) | head -n 1 2>/dev/null)
459465
RELEASE_DIR := out
460466
RELEASE_NOTES_DIR := releasenotes
461-
PREVIOUS_TAG ?= $(shell git tag -l | grep -B 1 $(RELEASE_TAG) | head -n 1)
462467

463468
$(RELEASE_DIR):
464469
mkdir -p $(RELEASE_DIR)/
@@ -475,7 +480,11 @@ release-manifests: $(KUSTOMIZE) $(RELEASE_DIR) ## Builds the manifests to publis
475480

476481
.PHONY: release-notes
477482
release-notes: $(RELEASE_NOTES_DIR) $(RELEASE_NOTES)
478-
go run ./hack/tools/release/notes.go --from=$(PREVIOUS_TAG) > $(RELEASE_NOTES_DIR)/releasenotes.md
483+
if [ -n "${PRE_RELEASE}" ]; then \
484+
echo ":rotating_light: This is a RELEASE CANDIDATE. Use it only for testing purposes. If you find any bugs, file an [issue](https://github.com/metal3-io/cluster-api-provider-metal3/issues/new/)." > $(RELEASE_NOTES_DIR)/$(RELEASE_TAG).md; \
485+
else \
486+
go run ./hack/tools/release/notes.go --from=$(PREVIOUS_TAG) > $(RELEASE_NOTES_DIR)/$(RELEASE_TAG).md; \
487+
fi
479488

480489
.PHONY: release
481490
release:

0 commit comments

Comments
 (0)