From 5c331bc9216abdc4fb0a9ef8e80a6892c4b90065 Mon Sep 17 00:00:00 2001 From: Hiroki Teranishi Date: Sat, 3 May 2025 03:32:01 +0900 Subject: [PATCH 1/4] Use dynamic version. --- pylsp_isort/__init__.py | 1 + pylsp_isort/_version.py | 1 + pyproject.toml | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 pylsp_isort/_version.py diff --git a/pylsp_isort/__init__.py b/pylsp_isort/__init__.py index e69de29..0e06ac4 100644 --- a/pylsp_isort/__init__.py +++ b/pylsp_isort/__init__.py @@ -0,0 +1 @@ +from pylsp_isort._version import __version__ diff --git a/pylsp_isort/_version.py b/pylsp_isort/_version.py new file mode 100644 index 0000000..6c8e6b9 --- /dev/null +++ b/pylsp_isort/_version.py @@ -0,0 +1 @@ +__version__ = "0.0.0" diff --git a/pyproject.toml b/pyproject.toml index 9e0e48d..eb5e620 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,6 @@ build-backend = "hatchling.build" [project] name = "python-lsp-isort" -version = "0.2.0" authors = [ {name = "Hiroki Teranishi", email = "teranishi.hiroki@gmail.com"} ] @@ -16,6 +15,7 @@ dependencies = [ "python-lsp-server", "isort>=5.0", ] +dynamic = ["version"] [project.urls] Homepage = "https://github.com/chantera/python-lsp-isort" @@ -39,6 +39,9 @@ only-packages = true [tool.hatch.build.targets.wheel] packages = ["pylsp_isort"] +[tool.hatch.version] +path = "pylsp_isort/_version.py" + [tool.ruff] line-length = 99 extend-exclude = ["tests/fixtures/*"] From 6b402156387f6e989f4a1fdf7a94bf5fd037b1b7 Mon Sep 17 00:00:00 2001 From: Hiroki Teranishi Date: Sat, 3 May 2025 03:56:37 +0900 Subject: [PATCH 2/4] Add release workflow. --- .github/workflows/release.yml | 48 +++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..68e3fdf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,48 @@ +name: Release + +on: + push: + tags: + - "v[0-9]+.*" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install hatch + - name: Build + run: | + python -m hatch version "${GITHUB_REF_NAME}" + python -m hatch build + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: dist-artifacts + path: dist/ + + publish: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: dist-artifacts + path: dist/ + - name: Publish to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + password: ${{ secrets.TEST_PYPI_API_TOKEN }} + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} From 8e8612de49c1f0bc1e6f9e6fe3b98e1229cd3b80 Mon Sep 17 00:00:00 2001 From: Hiroki Teranishi Date: Sat, 3 May 2025 04:02:29 +0900 Subject: [PATCH 3/4] Fix. --- pylsp_isort/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylsp_isort/__init__.py b/pylsp_isort/__init__.py index 0e06ac4..567ec86 100644 --- a/pylsp_isort/__init__.py +++ b/pylsp_isort/__init__.py @@ -1 +1 @@ -from pylsp_isort._version import __version__ +from pylsp_isort._version import __version__ # noqa: F401 From e9e1b6b6c340e42ce28b6c8e3552b6c9f9a556ad Mon Sep 17 00:00:00 2001 From: Hiroki Teranishi Date: Sat, 3 May 2025 04:18:39 +0900 Subject: [PATCH 4/4] Fix. --- .github/workflows/release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 68e3fdf..40ecc3c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,11 +22,11 @@ jobs: run: | python -m hatch version "${GITHUB_REF_NAME}" python -m hatch build - - name: Upload build artifacts - uses: actions/upload-artifact@v4 - with: - name: dist-artifacts - path: dist/ + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: dist-artifacts + path: dist/ publish: needs: build