From 13928fe091e664f62cba18528cdfad9ac3b4a7e3 Mon Sep 17 00:00:00 2001 From: Mauricio Villegas <5780272+mauvilsa@users.noreply.github.com> Date: Thu, 10 Jul 2025 06:30:38 +0200 Subject: [PATCH 1/4] Publish package to pypi using github action --- .bumpversion.cfg | 11 +++++++++++ .github/workflows/build.yml | 35 ++++++++++++++++++++++++++++++++++- .gitignore | 4 +++- pyproject.toml | 2 +- 4 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 .bumpversion.cfg diff --git a/.bumpversion.cfg b/.bumpversion.cfg new file mode 100644 index 0000000..16c9b42 --- /dev/null +++ b/.bumpversion.cfg @@ -0,0 +1,11 @@ +[bumpversion] +current_version = 0.16.0 +commit = True +tag = True +tag_name = v{new_version} +parse = (?P\d+)\.(?P\d+)\.(?P\d+)(?P(\.dev|rc)[0-9]+)? +serialize = + {major}.{minor}.{patch}{release} + {major}.{minor}.{patch} + +[bumpversion:file:pyproject.toml] diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d428630..2774834 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ env: PYTHONIOENCODING: "utf-8" jobs: - build: + tests: runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -33,3 +33,36 @@ jobs: with: python-version: 3.x - uses: pre-commit/action@v3.0.1 + + build-package: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" + - name: Build package + run: | + pip install -U build + python -m build + - uses: actions/upload-artifact@v4 + with: + name: package + path: ./dist/* + + pypi-publish: + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + needs: [tests, style, build-package] + environment: + name: pypi + url: https://pypi.org/p/jsonargparse + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + name: package + path: dist + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.gitignore b/.gitignore index 799a0f3..9a945dd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ /.gitignore __pycache__ *.egg-info -.idea/ \ No newline at end of file +.idea/ +venv* +dist diff --git a/pyproject.toml b/pyproject.toml index 410d1a7..102b7a0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "docstring_parser" -version = "0.16" +version = "0.16.0" description = "Parse Python docstrings in reST, Google and Numpydoc format" authors = [ {name="Marcin Kurczewski", email="dash@wind.garden"}, From cf8c49c081547f8cca6ab7eb9a1142feba3d74af Mon Sep 17 00:00:00 2001 From: Mauricio Villegas <5780272+mauvilsa@users.noreply.github.com> Date: Thu, 10 Jul 2025 06:36:41 +0200 Subject: [PATCH 2/4] Fix workflow --- .github/workflows/build.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2774834..305e0e7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,13 @@ name: Build -on: [push, pull_request] +on: + push: + branches: [master] + tags: + - 'v*' + pull_request: + branches: [master] + workflow_dispatch: env: PYTHONIOENCODING: "utf-8" From f4fdce3afd0606282ce4cc0ecbb99792b4763659 Mon Sep 17 00:00:00 2001 From: Mauricio Villegas <5780272+mauvilsa@users.noreply.github.com> Date: Thu, 10 Jul 2025 06:58:55 +0200 Subject: [PATCH 3/4] Fix tag format --- .bumpversion.cfg | 2 +- .github/workflows/build.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 16c9b42..00b5f44 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -2,7 +2,7 @@ current_version = 0.16.0 commit = True tag = True -tag_name = v{new_version} +tag_name = {new_version} parse = (?P\d+)\.(?P\d+)\.(?P\d+)(?P(\.dev|rc)[0-9]+)? serialize = {major}.{minor}.{patch}{release} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 305e0e7..fc412ca 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: push: branches: [master] tags: - - 'v*' + - '[0-9]*' pull_request: branches: [master] workflow_dispatch: @@ -58,7 +58,7 @@ jobs: path: ./dist/* pypi-publish: - if: startsWith(github.ref, 'refs/tags/v') + if: startsWith(github.ref, 'refs/tags/') runs-on: ubuntu-latest needs: [tests, style, build-package] environment: From 069f48083d97d3ccc5ce532ea5275ba2f7ca6ca8 Mon Sep 17 00:00:00 2001 From: Mauricio Villegas <5780272+mauvilsa@users.noreply.github.com> Date: Thu, 10 Jul 2025 10:07:01 +0200 Subject: [PATCH 4/4] Fix publish URL --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fc412ca..a72ecb7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -63,7 +63,7 @@ jobs: needs: [tests, style, build-package] environment: name: pypi - url: https://pypi.org/p/jsonargparse + url: https://pypi.org/p/docstring-parser permissions: id-token: write steps: