From 4318be6fd92f61e0b2617c18deb0818e4a6ab22f Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Tue, 30 May 2023 12:17:53 +0200 Subject: [PATCH] feat: Add pypi actions (#335) * Add pypi actions * Bump version to 2.0.0rc1 * Remove upgrade settings for ruff * Update pyproject.toml for ruff * Update actions * Update .github/workflows/publish-to-test-pypi.yml Co-authored-by: Mark Walker * Update .github/workflows/publish-to-test-pypi.yml Co-authored-by: Mark Walker * Update CHANGELOG.rst --------- Co-authored-by: Mark Walker --- .github/workflows/publish-to-live-pypi.yml | 41 +++++++++++++++++++++ .github/workflows/publish-to-test-pypi.yml | 43 ++++++++++++++++++++++ CHANGELOG.rst | 4 +- djangocms_versioning/__init__.py | 2 +- pyproject.toml | 5 +-- 5 files changed, 88 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/publish-to-live-pypi.yml create mode 100644 .github/workflows/publish-to-test-pypi.yml diff --git a/.github/workflows/publish-to-live-pypi.yml b/.github/workflows/publish-to-live-pypi.yml new file mode 100644 index 00000000..2d8272e2 --- /dev/null +++ b/.github/workflows/publish-to-live-pypi.yml @@ -0,0 +1,41 @@ +name: Publish Python 🐍 distributions 📦 to pypi + +on: + release: + types: + - published + +jobs: + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to pypi + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/djangocms-versioning + permissions: + id-token: write + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install pypa/build + run: >- + python -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: >- + python -m + build + --sdist + --wheel + --outdir dist/ + . + + - name: Publish distribution 📦 to PyPI + if: startsWith(github.ref, 'refs/tags') + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/workflows/publish-to-test-pypi.yml b/.github/workflows/publish-to-test-pypi.yml new file mode 100644 index 00000000..fd1cf6fb --- /dev/null +++ b/.github/workflows/publish-to-test-pypi.yml @@ -0,0 +1,43 @@ +name: Publish Python 🐍 distributions 📦 to TestPyPI + +on: + push: + branches: + - master + +jobs: + build-n-publish: + name: Build and publish Python 🐍 distributions 📦 to TestPyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://test.pypi.org/p/djangocms-versioning + permissions: + id-token: write + steps: + - uses: actions/checkout@v3 + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install pypa/build + run: >- + python -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: >- + python -m + build + --sdist + --wheel + --outdir dist/ + . + + - name: Publish distribution 📦 to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + skip_existing: true diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d95fe481..d3036ef6 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -2,8 +2,8 @@ Changelog ========= -Unreleased -========== +2.0.0rc1 +======== * fix: Only try modifying page language menu if it is present * fix: Added ``related_name`` attribute to the ``content_type`` foreign key of the ``Version`` model. * fix: burger menu adjusts to the design of django cms core dropdown diff --git a/djangocms_versioning/__init__.py b/djangocms_versioning/__init__.py index bc86c944..0cda2d10 100644 --- a/djangocms_versioning/__init__.py +++ b/djangocms_versioning/__init__.py @@ -1 +1 @@ -__version__ = "1.2.2" +__version__ = "2.0.0rc1" diff --git a/pyproject.toml b/pyproject.toml index 8f8d7706..c6a1005d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,6 +40,7 @@ ignore = [ "PLR0913", # Too many arguments to function call "PLR0915", # Too many statements "PLR2004", # Magic value used in comparison, consider replacing with a constant variable + "UP007", # Use `X | Y` for type annotations ] [tool.ruff.per-file-ignores] @@ -53,7 +54,3 @@ known-first-party = [ "djangocms_versioning", ] extra-standard-library = ["dataclasses"] - -[tool.ruff.pyupgrade] -# Preserve types, even if a file imports `from __future__ import annotations`. -keep-runtime-typing = true