From 92f16e9ba6ccc1cf8dcc1e5007ae6e576aaa7970 Mon Sep 17 00:00:00 2001 From: Fabrice Normandin Date: Fri, 31 Jan 2025 17:43:03 -0500 Subject: [PATCH] Update the publish.yml workflow for UV (#143) * Update the publish.yml workflow for UV Signed-off-by: Fabrice Normandin * Remove hard-coded version in __version__.py Signed-off-by: Fabrice Normandin --------- Signed-off-by: Fabrice Normandin --- .github/workflows/publish.yml | 27 ++++++++++----------------- milatools/__version__.py | 4 +++- uv.lock | 3 +-- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 852b0c71..460cffcf 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,24 +20,17 @@ jobs: environment: release steps: - uses: actions/checkout@v4 - - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + - name: Install the latest version of uv + uses: astral-sh/setup-uv@v5 with: python-version: ${{ matrix.python-version }} - - - name: Install poetry - run: | - python -m pip install --upgrade pip - pip install poetry - + enable-cache: true + # https://github.com/astral-sh/setup-uv?tab=readme-ov-file#github-authentication-token + github-token: ${{ secrets.GITHUB_TOKEN }} + cache-suffix: ${{ matrix.python-version }} - name: Install dependencies - run: | - poetry install - poetry self add "poetry-dynamic-versioning[plugin]" - poetry dynamic-versioning enable - + run: uv sync + - name: Building the package + run: uv build - name: Publish package - env: - POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} - run: poetry publish --build + run: uv publish --trusted-publishing always diff --git a/milatools/__version__.py b/milatools/__version__.py index ae736254..0d29162c 100644 --- a/milatools/__version__.py +++ b/milatools/__version__.py @@ -1 +1,3 @@ -__version__ = "0.1.3" +import importlib.metadata + +__version__ = importlib.metadata.version("milatools") diff --git a/uv.lock b/uv.lock index 23cfb06f..c8f583e0 100644 --- a/uv.lock +++ b/uv.lock @@ -343,7 +343,6 @@ wheels = [ [[package]] name = "milatools" -version = "0.1.6.post9+d91f538" source = { editable = "." } dependencies = [ { name = "blessed" }, @@ -715,7 +714,7 @@ name = "tqdm" version = "4.67.1" source = { registry = "https://pypi.org/simple" } dependencies = [ - { name = "colorama", marker = "platform_system == 'Windows'" }, + { name = "colorama", marker = "sys_platform == 'win32'" }, ] sdist = { url = "https://files.pythonhosted.org/packages/a8/4b/29b4ef32e036bb34e4ab51796dd745cdba7ed47ad142a9f4a1eb8e0c744d/tqdm-4.67.1.tar.gz", hash = "sha256:f8aef9c52c08c13a65f30ea34f4e5aac3fd1a34959879d7e59e63027286627f2", size = 169737 } wheels = [