Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use poetry-dynamic-versioning: it's incompatible with pre-commit #25

Merged
merged 1 commit into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
workflow_dispatch:
inputs:
tag:
description: "Tag to release"
required: true
type: string

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- uses: actions/setup-python@v5
with:
cache: "poetry"

- run: poetry install

- run: poetry version "${{ github.event.inputs.tag }}"

- run: git commit -am "Release ${{ github.event.inputs.tag }}"
env:
GIT_AUTHOR_NAME: "GitHub Actions"
GIT_AUTHOR_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
GIT_COMMITTER_NAME: "GitHub Actions"
GIT_COMMITTER_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"

- run: git push origin

- run: >
gh release create "${{ github.event.inputs.tag }}"
--title "${{ github.event.inputs.tag }}"
--generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 changes: 28 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Contributing

Contributions are welcome! The project is quite small so feel free to
familiarize yourself with the codebase and open an issue or a pull request.
Before doing anything important, feel free to open an issue to discuss it.

All interactions are required to follow the
[Code of Conduct](CODE_OF_CONDUCT.md) which sets rules for the community.

## Development

The project uses [Poetry](https://python-poetry.org/),
[pre-commit](https://pre-commit.com/), and
[pytest](https://docs.pytest.org/en/stable/).

```console
$ poetry install
$ pre-commit install
$ poetry run pytest
```

If you have any questions, feel free to ask them in the issues.

# Internal documentation

## Releasing

Launch the `Release`worfklow with the desired tag.
11 changes: 3 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[build-system]
requires = ["poetry-core", "poetry-dynamic-versioning"]
build-backend = "poetry_dynamic_versioning.backend"
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "poetry_to_pre_commit"
version = "0.0.0"
version = "2.1.0"
description = "Sync versions in .pre-commit-config.yaml from poetry.lock"
authors = ["Joachim Jablon"]
license = "MIT License"
Expand Down Expand Up @@ -41,11 +41,6 @@ pytest = "*"
pytest-cov = "*"
pytest-mock = "*"

[tool.poetry-dynamic-versioning]
enable = true
pattern = '(?P<base>\d+(\.\d+)*)([-._]?((?P<stage>[a-zA-Z]+)[-._]?(?P<revision>\d+)?))?$'
vcs = 'git'

[tool.pytest.ini_options]
addopts = [
"--cov-report=term-missing",
Expand Down
Loading