Skip to content

Commit

Permalink
chore(ci): Add conventional commits hook and release notes publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
paveldedik committed Mar 18, 2024
1 parent 9d47ac4 commit a39a7bd
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 18 deletions.
6 changes: 0 additions & 6 deletions .commitsar.yaml

This file was deleted.

27 changes: 21 additions & 6 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,45 @@
name: Publish

on:
workflow_dispatch:
push:
tags:
- '*'
- "[2-9].[0-9]+.[0-9]+"
- "[2-9].[0-9]+.[0-9]+-pre[0-9]?"

jobs:
publish:
name: Publish to PyPI
name: Release to GitHub and PyPI
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: "**/pyproject.toml"

- run: pip install hatchling

- name: Build package
- name: Build Package
run: hatchling build

- name: Publish distribution package to PyPI
- name: Publish Release Notes
id: release
uses: softprops/action-gh-release@v2
with:
files: |
./dist/*.whl
./dist/*.tar.gz
prerelease: ${{ contains(github.ref, '-pre') }}
generate_release_notes: ${{ !contains(github.ref, '-pre') }}

- name: Publish Distribution Package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
17 changes: 15 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
default_language_version:
python: python3.12

default_install_hook_types:
- pre-commit
- commit-msg

default_stages:
- pre-commit

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand All @@ -14,12 +21,12 @@ repos:
- id: detect-private-key

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
rev: v0.3.2
hooks:
- id: ruff-format

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
rev: v0.3.2
hooks:
- id: ruff
args: ["--fix", "--exit-non-zero-on-fix", "--config", "pyproject.toml"]
Expand All @@ -32,3 +39,9 @@ repos:
additional_dependencies:
- types-cachetools
- typeguard

- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.1.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
3 changes: 1 addition & 2 deletions ludic/web/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@


class AppProtocol(Protocol):
def url_path_for(self, name: str, /, **path_params: Any) -> URLPath:
...
def url_path_for(self, name: str, /, **path_params: Any) -> URLPath: ...


class RoutedProtocol(Protocol):
Expand Down
10 changes: 8 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[build-system]
requires = ["hatchling"]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"

[project]
name = "ludic"
version = "0.1.3"
dynamic = ["version"]
description = "Lightweight framework for building HTML pages in pure Python."
keywords = ["html", "htmx", "async", "web", "templating"]
authors = [{ name = "Pavel Dedík", email = "[email protected]" }]
Expand Down Expand Up @@ -39,6 +39,12 @@ test = [
"httpx",
]

[tool.hatch.version]
source = "vcs"

[tool.hatch.build.hooks.vcs]
version-file = "_version.py"

[tool.ruff]
line-length = 88
target-version = "py312"
Expand Down

0 comments on commit a39a7bd

Please sign in to comment.