Skip to content

Commit ab2942c

Browse files
Merge pull request #11 from Lash-L/semantic_release
feat: Add automatic release
2 parents def2514 + 012cd9d commit ab2942c

File tree

3 files changed

+50
-0
lines changed

3 files changed

+50
-0
lines changed

.github/workflows/ci.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ concurrency:
1111
cancel-in-progress: true
1212

1313
jobs:
14+
# Make sure commit messages follow the conventional commits convention:
15+
# https://www.conventionalcommits.org
16+
commitlint:
17+
name: Lint Commit Messages
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
- uses: wagoid/[email protected]
24+
1425
test:
1526
strategy:
1627
fail-fast: false
@@ -36,3 +47,26 @@ jobs:
3647
- name: Test with Pytest
3748
run: poetry run pytest
3849
shell: bash
50+
release:
51+
runs-on: ubuntu-latest
52+
environment: release
53+
if: github.ref == 'refs/heads/main'
54+
needs:
55+
- test
56+
57+
steps:
58+
- uses: actions/checkout@v3
59+
with:
60+
fetch-depth: 0
61+
62+
# Run semantic release:
63+
# - Update CHANGELOG.md
64+
# - Update version in code
65+
# - Create git tag
66+
# - Create GitHub release
67+
# - Publish to PyPI
68+
- name: Python Semantic Release
69+
uses: relekang/[email protected]
70+
with:
71+
github_token: ${{ secrets.GH_TOKEN }}
72+
pypi_token: ${{ secrets.PYPI_TOKEN }}

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,8 @@ build-backend = "poetry.core.masonry.api"
2828
pytest-asyncio = "*"
2929
pytest = "*"
3030

31+
[tool.semantic_release]
32+
branch = "main"
33+
version_toml = "pyproject.toml:tool.poetry.version"
34+
version_variable = "setup.py:__version__"
35+
build_command = "pip install poetry && poetry build"

setup.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env python
2+
3+
# This is a shim to allow GitHub to detect the package, build is done with poetry
4+
# Taken from https://github.com/Textualize/rich
5+
6+
import setuptools
7+
8+
__version__ = "0.1.10"
9+
10+
if __name__ == "__main__":
11+
setuptools.setup(name="roborock", version=__version__)

0 commit comments

Comments
 (0)