diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..90c879b --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,50 @@ +name: Publish to PyPI + +on: + push: + tags: + - "v*" + release: + types: [published] + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +jobs: + build-and-publish: + name: Build & Publish distribution to PyPI + runs-on: ubuntu-latest + permissions: + # Mandatory permission for PyPI Trusted Publishing (OIDC token exchange) + id-token: write + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install build tools + run: | + python -m pip install --upgrade pip + python -m pip install build twine + + - name: Build binary wheel and source distribution + run: | + python -m build + + - name: Verify package metadata and archives + run: | + python -m twine check --strict dist/* + + - name: Publish package distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + skip-existing: true + verbose: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..f25b829 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,55 @@ +name: Tests + +on: + push: + branches: + - main + - master + tags: + - "v*" + pull_request: + branches: + - main + - master + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Python ${{ matrix.python-version }} / Django ${{ matrix.django-version }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12", "3.13"] + django-version: ["4.2", "5.0", "5.1"] + include: + - python-version: "3.14-dev" + django-version: "5.1" + exclude: + - python-version: "3.13" + django-version: "4.2" + - python-version: "3.13" + django-version: "5.0" + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install "django~=${{ matrix.django-version }}.0" -e . + + - name: Run test suite + run: | + ./bin/test.sh diff --git a/README.md b/README.md index 2b0a3b4..fbe2324 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # django-alpine [![PyPI Version](https://img.shields.io/pypi/v/django-alpine.svg)](https://pypi.org/project/django-alpine/) +[![Tests](https://img.shields.io/github/actions/workflow/status/ProKelly/django-alpine/test.yml?branch=main&label=tests)](https://github.com/ProKelly/django-alpine/actions/workflows/test.yml) [![Python Versions](https://img.shields.io/pypi/pyversions/django-alpine.svg)](https://pypi.org/project/django-alpine/) [![Django Versions](https://img.shields.io/pypi/djversions/django-alpine.svg)](https://pypi.org/project/django-alpine/) [![License](https://img.shields.io/badge/license-BSD--3--Clause-blue.svg)](LICENSE) diff --git a/pyproject.toml b/pyproject.toml index 66141ee..c968d16 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,7 +27,6 @@ classifiers = [ "Framework :: Django :: 5.1", "Framework :: Django :: 5.2", "Intended Audience :: Developers", - "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", @@ -53,6 +52,9 @@ dev = [ "requests>=2.28.0", "pytest>=8.0", "pytest-django>=4.8", + "commitizen>=3.20.0", + "build>=1.0.0", + "twine>=5.0.0", ] [project.urls] @@ -69,3 +71,14 @@ django_alpine = [ "static/django_alpine/*.js", "static/django_alpine/**/*.js", ] + +[tool.commitizen] +name = "cz_conventional_commits" +tag_format = "v$version" +version_scheme = "semver" +version_provider = "pep621" +update_changelog_on_bump = true +major_version_zero = true +version_files = [ + "django_alpine/__init__.py:__version__", +]