From 27cd03bdad31cb360a1b4fc795af0212f4dcd738 Mon Sep 17 00:00:00 2001 From: Alex Carney Date: Thu, 2 May 2024 16:48:28 +0000 Subject: [PATCH] devenv: Add make release target --- code/Makefile | 6 +++++- lib/esbonio/Makefile | 3 +++ scripts/make_release.py | 11 +++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/code/Makefile b/code/Makefile index ad31dc4f..227255ab 100644 --- a/code/Makefile +++ b/code/Makefile @@ -2,7 +2,7 @@ include ../.devcontainer/tools.mk ESBONIO ?= --pre esbonio -.PHONY: dist dev-deps release-deps +.PHONY: dist dev-deps release-deps release watch: dev-deps $(NPM) -test -d dist && rm -r dist @@ -16,6 +16,10 @@ dist: release-deps $(NPM) -test -d dist && rm -r dist $(NPM) run package +release: $(TOWNCRIER) $(HATCH) $(PY) + $(PY) ../scripts/make_release.py lsp + $(PY) ../scripts/make_release.py vscode + # Ensures the version of esbonio in ../lib/esbonio is used. dev-deps: node_modules/.installed bundled/libs/.installed -test -d bundled/libs/esbonio-*.dist-info && rm -r bundled/libs/esbonio-*.dist-info diff --git a/lib/esbonio/Makefile b/lib/esbonio/Makefile index 66cdc77a..35839016 100644 --- a/lib/esbonio/Makefile +++ b/lib/esbonio/Makefile @@ -4,3 +4,6 @@ include ../../.devcontainer/tools.mk dist: $(HATCH) $(HATCH) build + +release: $(TOWNCRIER) $(HATCH) $(PY) + $(PY) ../scripts/make_release.py lsp diff --git a/scripts/make_release.py b/scripts/make_release.py index ff7e201a..c036b681 100755 --- a/scripts/make_release.py +++ b/scripts/make_release.py @@ -6,6 +6,7 @@ - Commit, tag and push the new version (if it's a release) - Export the tag name and release date for use later on in the pipeline. """ + import argparse import io import json @@ -27,6 +28,8 @@ ENV = os.environ.get("GITHUB_ENV", "") STEP_SUMMARY = os.environ.get("GITHUB_STEP_SUMMARY", "") +REPO = pathlib.Path(__file__).parent.parent.resolve() + class Output: """An output destination that can be logged to. @@ -78,7 +81,7 @@ class Component(TypedDict): """The prefix to give to version bump commit messages for this component.""" src: str - """The directory containing the component, relative to repo root.""" + """The directory containing the component.""" tag_prefix: str """The prefix to give to tagged versions of this component.""" @@ -93,7 +96,7 @@ class Component(TypedDict): bump_minor="minor", bump_patch="patch", commit_prefix="Esbonio Extensions Release v", - src="lib/esbonio-extensions", + src=str(REPO / "lib/esbonio-extensions"), tag_prefix="esbonio-extensions-v", ), Component( @@ -103,7 +106,7 @@ class Component(TypedDict): bump_minor="b", bump_patch="b", commit_prefix="Esbonio Language Server Release v", - src="lib/esbonio", + src=str(REPO / "lib/esbonio"), tag_prefix="esbonio-language-server-v", ), Component( @@ -113,7 +116,7 @@ class Component(TypedDict): bump_minor="minor", bump_patch="patch", commit_prefix="Esbonio VSCode Extension Release v", - src="code", + src=str(REPO / "code"), tag_prefix="esbonio-vscode-extension-v", ), ]