Skip to content

Commit

Permalink
feat: implement semantic versioning
Browse files Browse the repository at this point in the history
forces conventional commit messaging via pre-commit hook.
also implements automatic semantic releases via GH action.
  • Loading branch information
lalewis1 committed Nov 6, 2024
1 parent 2ce1b3f commit ad3a343
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 12 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Continuous Delivery

on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest
concurrency: release

permissions:
id-token: write
contents: write

steps:
# Note: we need to checkout the repository at the workflow sha in case during the workflow
# the branch was updated. To keep PSR working with the configured release branches,
# we force a checkout of the desired release branch but at the workflow sha HEAD.
- name: Setup | Checkout Repository at workflow sha
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.sha }}

- name: Setup | Force correct release branch on workflow sha
run: |
git checkout -B ${{ github.ref_name }} ${{ github.sha }}
- name: Action | Semantic Version Release
id: release
# Adjust tag with desired version if applicable.
uses: python-semantic-release/python-semantic-release@v9.11.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
git_committer_name: "github-actions"
git_committer_email: "actions@users.noreply.github.com"

- name: Publish | Upload to GitHub Release Assets
uses: python-semantic-release/publish-action@v9.8.9
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ steps.release.outputs.tag }}

24 changes: 20 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,28 @@ repos:
- id: check-yaml
- id: check-json
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/codespell-project/codespell
rev: v2.1.0
hooks:
- id: codespell
args: [--skip, "*.ttl"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.1
hooks:
- id: ruff
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.8.0
hooks:
- id: black
language_version: python3.12
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/compilerla/conventional-pre-commit
rev: v3.4.0
hooks:
- id: conventional-pre-commit
stages: [commit-msg]
args: [--strict]

24 changes: 16 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "prez"
version = "0.1.0.dev0"
version = "4.1.2"
description = "A python application for displaying linked data on the web"
authors = ["Jamie Feiss <jamie.feiss@gmail.com>", "Nicholas Car <nick@kurrawong.net>", "David Habgood <dcchabgood@gmail.com>"]
packages = [
Expand Down Expand Up @@ -36,9 +36,6 @@ python-multipart = "^0.0.9"
pyoxigraph = "^0.4.2"
oxrdflib = {git = "https://github.com/oxigraph/oxrdflib.git", rev = "main"}

[tool.poetry.extras]
server = ["uvicorn"]

[tool.poetry.group.dev.dependencies]
pytest = "^8.2.1"
pre-commit = "^2.15.0"
Expand All @@ -50,12 +47,23 @@ coverage = "^7.3.2"
tabulate = "^0.9.0"
ogctests = "^0.1.15"

[build-system]
requires = ["poetry-core>=1.9.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry.extras]
server = ["uvicorn"]

[tool.black]
line-length = 88

[tool.pytest.ini_options]
[tool.isort]
profile = "black"

[tool.semantic_release]
version_toml = ["pyproject.toml:tool.poetry.version"]

[pytest]
pythonpath = ["prez"]
testpaths = ["tests"]

[build-system]
requires = ["poetry-core>=1.9.0"]
build-backend = "poetry.core.masonry.api"

0 comments on commit ad3a343

Please sign in to comment.