Skip to content

Commit da5a7d5

Browse files
committed
chore: improvve makefile and release.yaml
Signed-off-by: krishna-kg732 <krishnagupta.kg2k6@gmail.com>
1 parent 602e9f9 commit da5a7d5

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,4 @@ jobs:
175175
target_commitish: ${{ github.sha }}
176176
prerelease: ${{ needs.prepare.outputs.is-prerelease == 'true' }}
177177
draft: false
178-
body: ${{ steps.cliff.outputs.content }}
178+
body: ${{ steps.changelog.outputs.content }}

Makefile

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,31 @@ VERSION ?=
249249
GITHUB_TOKEN ?=
250250

251251
.PHONY: release
252-
release: ## Create a new release.
253-
@if [ -z "$(VERSION)" ]; then \
254-
echo "ERROR: VERSION is required. Usage: make release VERSION=X.Y.Z GITHUB_TOKEN=<token>"; \
252+
release: ## Create a new release and generate changelog.
253+
@if [ -z "$(VERSION)" ] || ! echo "$(VERSION)" | grep -E -q '^[0-9]+\.[0-9]+\.[0-9]+$$'; then \
254+
echo "ERROR: VERSION must be set in X.Y.Z format. Usage: make release VERSION=X.Y.Z"; \
255255
exit 1; \
256256
fi
257+
258+
@if [ -z "$(GITHUB_TOKEN)" ]; then \
259+
echo "ERROR: GITHUB_TOKEN is required. Usage: make release VERSION=X.Y.Z GITHUB_TOKEN=<token>"; \
260+
exit 1; \
261+
fi
262+
263+
@echo "Fetching upstream tags..."
264+
@git fetch --tags https://github.com/kubeflow/trainer.git
265+
266+
@echo "Generating changelog for v$(VERSION)..."
267+
@if ! git-cliff --unreleased --tag "v$(VERSION)" --prepend CHANGELOG.md; then \
268+
echo ""; \
269+
echo "ERROR: git-cliff failed."; \
270+
echo "Ensure git-cliff is installed and GITHUB_TOKEN is valid."; \
271+
exit 1; \
272+
fi
273+
274+
@echo "Running release script..."
257275
@export GITHUB_TOKEN=$(GITHUB_TOKEN); \
258276
./hack/release.sh $(VERSION)
277+
278+
@echo ""
279+
@echo "✅ Release v$(VERSION) prepared successfully."

0 commit comments

Comments
 (0)