From f32e6fe98e5766f9403e6d35044fb801a36f4e14 Mon Sep 17 00:00:00 2001 From: phernandez Date: Thu, 14 Nov 2024 21:55:30 -0600 Subject: [PATCH] chore: add github actions release workflow --- .github/workflows/release.yml | 49 ++++++++++++ pyproject.toml | 15 +++- uv.lock | 143 ++++++++++++++++++++++++++++++++-- 3 files changed, 200 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..503cb86f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +name: Release +on: + workflow_dispatch: + inputs: + version_type: + description: 'Type of version bump (major, minor, patch)' + required: true + default: 'patch' + type: choice + options: + - patch + - minor + - major + release: + types: [published] + +jobs: + release: + runs-on: ubuntu-latest + concurrency: release + permissions: + id-token: write + contents: write + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install uv + run: | + curl -LsSf https://astral.sh/uv/install.sh | sh + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + + - name: Python Setup + uses: actions/setup-python@v4 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + uv pip install ".[dev]" + + - name: Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + run: semantic-release publish \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index f6be0c6b..dd9b0560 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -95,6 +95,7 @@ dev = [ "isort>=5.13.0", "mypy>=1.8.0", "ruff>=0.2.0", + "python-semantic-release>=9.14.0", ] # Full install with all features @@ -137,4 +138,16 @@ style = "default" [tool.pytest.ini_options] testpaths = ["tests"] python_files = ["test_*.py"] -addopts = "-ra -q" \ No newline at end of file +addopts = "-ra -q" + + +[tool.semantic_release] +version_variable = "basic_components/__init__.py:__version__" +version_toml = "pyproject.toml:project.version" +major_on_zero = false +branch = "main" +changelog_file = "CHANGELOG.md" +build_command = "uv build" +dist_path = "dist/" +upload_to_pypi = true +commit_message = "chore(release): {version} [skip ci]" \ No newline at end of file diff --git a/uv.lock b/uv.lock index 6341f6f9..a5b8042f 100644 --- a/uv.lock +++ b/uv.lock @@ -58,13 +58,13 @@ wheels = [ name = "basic-components" version = "0.1.0" source = { editable = "." } -dependencies = [ + +[package.optional-dependencies] +cli = [ { name = "copier" }, { name = "rich" }, { name = "typer" }, ] - -[package.optional-dependencies] dev = [ { name = "black" }, { name = "isort" }, @@ -118,10 +118,12 @@ full = [ { name = "pytest" }, { name = "pytest-playwright" }, { name = "python-frontmatter" }, + { name = "rich" }, { name = "ruff" }, { name = "setuptools" }, { name = "starlette-wtf" }, { name = "tomli" }, + { name = "typer" }, { name = "uvicorn" }, { name = "watchfiles" }, { name = "websockets" }, @@ -132,14 +134,20 @@ utils = [ { name = "jinjax" }, ] +[package.dependency-groups] +dev = [ + { name = "python-semantic-release" }, +] + [package.metadata] requires-dist = [ { name = "arel", marker = "extra == 'docs'", specifier = ">=0.3.0" }, + { name = "basic-components", extras = ["cli"], marker = "extra == 'full'" }, { name = "basic-components", extras = ["dev"], marker = "extra == 'full'" }, { name = "basic-components", extras = ["docs"], marker = "extra == 'full'" }, { name = "basic-components", extras = ["utils"], marker = "extra == 'full'" }, { name = "black", marker = "extra == 'dev'", specifier = ">=24.1.0" }, - { name = "copier", specifier = ">=9.4.1" }, + { name = "copier", marker = "extra == 'cli'", specifier = ">=9.4.1" }, { name = "copier", marker = "extra == 'docs'", specifier = ">=9.4.1" }, { name = "fastapi", extras = ["standard"], marker = "extra == 'docs'", specifier = ">=0.115.4" }, { name = "icecream", marker = "extra == 'docs'", specifier = ">=2.1.3" }, @@ -160,18 +168,21 @@ requires-dist = [ { name = "pytest", marker = "extra == 'docs'", specifier = ">=8.3.3" }, { name = "pytest-playwright", marker = "extra == 'docs'", specifier = ">=0.5.2" }, { name = "python-frontmatter", marker = "extra == 'docs'", specifier = ">=1.1.0" }, - { name = "rich", specifier = ">=13.7.0" }, + { name = "rich", marker = "extra == 'cli'", specifier = ">=13.7.0" }, { name = "ruff", marker = "extra == 'dev'", specifier = ">=0.2.0" }, { name = "setuptools", marker = "extra == 'docs'", specifier = ">=75.5.0" }, { name = "starlette-wtf", marker = "extra == 'docs'", specifier = ">=0.4.5" }, { name = "tomli", marker = "extra == 'docs'", specifier = ">=2.0.2" }, - { name = "typer", specifier = ">=0.9.0" }, + { name = "typer", marker = "extra == 'cli'", specifier = ">=0.9.0" }, { name = "uvicorn", marker = "extra == 'docs'", specifier = ">=0.32.0" }, { name = "watchfiles", marker = "extra == 'docs'", specifier = ">=0.24.0" }, { name = "websockets", marker = "extra == 'docs'", specifier = ">=13.1" }, { name = "wtforms", marker = "extra == 'docs'", specifier = ">=3.2.1" }, ] +[package.metadata.dependency-groups] +dev = [{ name = "python-semantic-release", specifier = ">=9.14.0" }] + [[package]] name = "black" version = "24.10.0" @@ -296,6 +307,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/00/2e/d53fa4befbf2cfa713304affc7ca780ce4fc1fd8710527771b58311a3229/click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28", size = 97941 }, ] +[[package]] +name = "click-option-group" +version = "0.5.6" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "click" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/e7/b8/91054601a2e05fd9060cb1baf56be5b24145817b059e078669e1099529c7/click-option-group-0.5.6.tar.gz", hash = "sha256:97d06703873518cc5038509443742b25069a3c7562d1ea72ff08bfadde1ce777", size = 16517 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/af/75/81ea958bc0f7e410257cb2a42531b93a7695a31930cde87192c010a52c50/click_option_group-0.5.6-py3-none-any.whl", hash = "sha256:38a26d963ee3ad93332ddf782f9259c5bdfe405e73408d943ef5e7d0c3767ec7", size = 12467 }, +] + [[package]] name = "colorama" version = "0.4.6" @@ -337,6 +360,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/68/1b/e0a87d256e40e8c888847551b20a017a6b98139178505dc7ffb96f04e954/dnspython-2.7.0-py3-none-any.whl", hash = "sha256:b4c34b7d10b51bcc3a5071e7b8dee77939f1e878477eeecc965e9835f63c6c86", size = 313632 }, ] +[[package]] +name = "dotty-dict" +version = "1.3.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/6a/ab/88d67f02024700b48cd8232579ad1316aa9df2272c63049c27cc094229d6/dotty_dict-1.3.1.tar.gz", hash = "sha256:4b016e03b8ae265539757a53eba24b9bfda506fb94fbce0bee843c6f05541a15", size = 7699 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/1a/91/e0d457ee03ec33d79ee2cd8d212debb1bc21dfb99728ae35efdb5832dc22/dotty_dict-1.3.1-py3-none-any.whl", hash = "sha256:5022d234d9922f13aa711b4950372a06a6d64cb6d6db9ba43d0ba133ebfce31f", size = 7014 }, +] + [[package]] name = "dunamai" version = "1.22.0" @@ -431,6 +463,30 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d5/08/c2409cb01d5368dcfedcbaffa7d044cc8957d57a9d0855244a5eb4709d30/funcy-2.0-py2.py3-none-any.whl", hash = "sha256:53df23c8bb1651b12f095df764bfb057935d49537a56de211b098f4c79614bb0", size = 30891 }, ] +[[package]] +name = "gitdb" +version = "4.0.11" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "smmap" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/19/0d/bbb5b5ee188dec84647a4664f3e11b06ade2bde568dbd489d9d64adef8ed/gitdb-4.0.11.tar.gz", hash = "sha256:bf5421126136d6d0af55bc1e7c1af1c397a34f5b7bd79e776cd3e89785c2b04b", size = 394469 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/fd/5b/8f0c4a5bb9fd491c277c21eff7ccae71b47d43c4446c9d0c6cff2fe8c2c4/gitdb-4.0.11-py3-none-any.whl", hash = "sha256:81a3407ddd2ee8df444cbacea00e2d038e40150acfa3001696fe0dcf1d3adfa4", size = 62721 }, +] + +[[package]] +name = "gitpython" +version = "3.1.43" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "gitdb" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/b6/a1/106fd9fa2dd989b6fb36e5893961f82992cf676381707253e0bf93eb1662/GitPython-3.1.43.tar.gz", hash = "sha256:35f314a9f878467f5453cc1fee295c3e18e52f1b99f10f6cf5b1682e968a9e7c", size = 214149 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e9/bd/cc3a402a6439c15c3d4294333e13042b915bbeab54edc457c723931fed3f/GitPython-3.1.43-py3-none-any.whl", hash = "sha256:eec7ec56b92aad751f9912a73404bc02ba212a23adb2c7098ee668417051a1ff", size = 207337 }, +] + [[package]] name = "greenlet" version = "3.1.1" @@ -580,6 +636,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3", size = 70442 }, ] +[[package]] +name = "importlib-resources" +version = "6.4.5" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/98/be/f3e8c6081b684f176b761e6a2fef02a0be939740ed6f54109a2951d806f3/importlib_resources-6.4.5.tar.gz", hash = "sha256:980862a1d16c9e147a59603677fa2aa5fd82b87f223b6cb870695bcfce830065", size = 43372 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/e1/6a/4604f9ae2fa62ef47b9de2fa5ad599589d28c9fd1d335f32759813dfa91e/importlib_resources-6.4.5-py3-none-any.whl", hash = "sha256:ac29d5f956f01d5e4bb63102a5a19957f1b9175e45649977264a1416783bb717", size = 36115 }, +] + [[package]] name = "iniconfig" version = "2.0.0" @@ -1088,6 +1153,19 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/49/87/3c8da047b3ec5f99511d1b4d7a5bc72d4b98751c7e78492d14dc736319c5/python_frontmatter-1.1.0-py3-none-any.whl", hash = "sha256:335465556358d9d0e6c98bbeb69b1c969f2a4a21360587b9873bfc3b213407c1", size = 9834 }, ] +[[package]] +name = "python-gitlab" +version = "4.13.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "requests" }, + { name = "requests-toolbelt" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/c4/ea/e2cde926d63526935c1df259177371a195089b631d67a577fe5c39fbc7e1/python_gitlab-4.13.0.tar.gz", hash = "sha256:576bfb0901faca0c6b2d1ff2592e02944a6ec3e086c3129fb43c2a0df56a1c67", size = 484996 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/6b/5e/5fb4dcae9f5af5463c16952823d446ca449cce920efe8669871f600f0ab9/python_gitlab-4.13.0-py3-none-any.whl", hash = "sha256:8299a054fb571da16e1a8c1868fff01f34ac41ea1410c713a4647b3bbb2aa279", size = 145254 }, +] + [[package]] name = "python-multipart" version = "0.0.12" @@ -1097,6 +1175,29 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/f5/0b/c316262244abea7481f95f1e91d7575f3dfcf6455d56d1ffe9839c582eb1/python_multipart-0.0.12-py3-none-any.whl", hash = "sha256:43dcf96cf65888a9cd3423544dd0d75ac10f7aa0c3c28a175bbcd00c9ce1aebf", size = 23246 }, ] +[[package]] +name = "python-semantic-release" +version = "9.14.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "click" }, + { name = "click-option-group" }, + { name = "dotty-dict" }, + { name = "gitpython" }, + { name = "importlib-resources" }, + { name = "jinja2" }, + { name = "pydantic" }, + { name = "python-gitlab" }, + { name = "requests" }, + { name = "rich" }, + { name = "shellingham" }, + { name = "tomlkit" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/71/19/72d0fb90df1b20b4623a99ddd9a454bfba02b832e85a3e27ab57ec38f715/python_semantic_release-9.14.0.tar.gz", hash = "sha256:5b69a626458bfb50686d27d9713160eb2bf9897b0c17985f1c68d7316b8e07b6", size = 233999 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/c4/8f/86c618d7df34d8a45b37b867bb7cdd0447ee142e902093f742546b97f1f0/python_semantic_release-9.14.0-py3-none-any.whl", hash = "sha256:f089a6ad976e909d5f87015e9f541f9fd503d3db41653efaf0157d874902e519", size = 107682 }, +] + [[package]] name = "python-slugify" version = "8.0.4" @@ -1199,6 +1300,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/f9/9b/335f9764261e915ed497fcdeb11df5dfd6f7bf257d4a6a2a686d80da4d54/requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6", size = 64928 }, ] +[[package]] +name = "requests-toolbelt" +version = "1.0.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "requests" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/f3/61/d7545dafb7ac2230c70d38d31cbfe4cc64f7144dc41f6e4e4b78ecd9f5bb/requests-toolbelt-1.0.0.tar.gz", hash = "sha256:7681a0a3d047012b5bdc0ee37d7f8f07ebe76ab08caeccfc3921ce23c88d5bc6", size = 206888 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/3f/51/d4db610ef29373b879047326cbf6fa98b6c1969d6f6dc423279de2b1be2c/requests_toolbelt-1.0.0-py2.py3-none-any.whl", hash = "sha256:cccfdd665f0a24fcf4726e690f65639d272bb0637b9b92dfd91a5568ccf6bd06", size = 54481 }, +] + [[package]] name = "rich" version = "13.9.3" @@ -1265,6 +1378,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d9/5a/e7c31adbe875f2abbb91bd84cf2dc52d792b5a01506781dbcf25c91daf11/six-1.16.0-py2.py3-none-any.whl", hash = "sha256:8abb2f1d86890a2dfb989f9a77cfcfd3e47c2a354b01111771326f8aa26e0254", size = 11053 }, ] +[[package]] +name = "smmap" +version = "5.0.1" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/88/04/b5bf6d21dc4041000ccba7eb17dd3055feb237e7ffc2c20d3fae3af62baa/smmap-5.0.1.tar.gz", hash = "sha256:dceeb6c0028fdb6734471eb07c0cd2aae706ccaecab45965ee83f11c8d3b1f62", size = 22291 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/a7/a5/10f97f73544edcdef54409f1d839f6049a0d79df68adbc1ceb24d1aaca42/smmap-5.0.1-py3-none-any.whl", hash = "sha256:e6d8668fa5f93e706934a62d7b4db19c8d9eb8cf2adbb75ef1b675aa332b69da", size = 24282 }, +] + [[package]] name = "sniffio" version = "1.3.1" @@ -1316,6 +1438,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/cf/db/ce8eda256fa131af12e0a76d481711abe4681b6923c27efb9a255c9e4594/tomli-2.0.2-py3-none-any.whl", hash = "sha256:2ebe24485c53d303f690b0ec092806a085f07af5a5aa1464f3931eec36caaa38", size = 13237 }, ] +[[package]] +name = "tomlkit" +version = "0.13.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/b1/09/a439bec5888f00a54b8b9f05fa94d7f901d6735ef4e55dcec9bc37b5d8fa/tomlkit-0.13.2.tar.gz", hash = "sha256:fff5fe59a87295b278abd31bec92c15d9bc4a06885ab12bcea52c71119392e79", size = 192885 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f9/b6/a447b5e4ec71e13871be01ba81f5dfc9d0af7e473da256ff46bc0e24026f/tomlkit-0.13.2-py3-none-any.whl", hash = "sha256:7a974427f6e119197f670fbbbeae7bef749a6c14e793db934baefc1b5f03efde", size = 37955 }, +] + [[package]] name = "typer" version = "0.12.5"