diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..40ecc3c --- /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 }} diff --git a/pylsp_isort/__init__.py b/pylsp_isort/__init__.py index e69de29..567ec86 100644 --- a/pylsp_isort/__init__.py +++ b/pylsp_isort/__init__.py @@ -0,0 +1 @@ +from pylsp_isort._version import __version__ # noqa: F401 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/*"]