Skip to content

Commit a5222a4

Browse files
authored
Release automation (#52)
* use setuptools-git-versioning to automate setting version * first try to auto deploy to Test PyPi
1 parent 31695c0 commit a5222a4

2 files changed

Lines changed: 64 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v2.*
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Set up Python 3.12
14+
uses: actions/setup-python@v5
15+
with:
16+
python-version: 3.12
17+
- name: Install dependencies
18+
run: |
19+
python -m pip install --upgrade pip
20+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
21+
pip install -e .
22+
- name: Lint with flake8
23+
run: |
24+
flake8 .
25+
- name: Test with pytest
26+
run: |
27+
pytest --junitxml=junit/test-results.xml
28+
- name: Build a binary wheel and a source tarball
29+
run: python3 -m build
30+
- name: Store the distribution packages
31+
uses: actions/upload-artifact@v3
32+
with:
33+
name: python-package-distributions
34+
path: dist/
35+
36+
publish-to-testpypi:
37+
name: Publish Python 🐍 distribution 📦 to TestPyPI
38+
needs:
39+
- build
40+
runs-on: ubuntu-latest
41+
42+
environment:
43+
name: testpypi
44+
url: https://test.pypi.org/p/agrirouter
45+
46+
permissions:
47+
id-token: write # IMPORTANT: mandatory for trusted publishing
48+
49+
steps:
50+
- name: Download all the dists
51+
uses: actions/download-artifact@v3
52+
with:
53+
name: python-package-distributions
54+
path: dist/
55+
- name: Publish distribution 📦 to TestPyPI
56+
uses: pypa/gh-action-pypi-publish@release/v1
57+
with:
58+
repository-url: https://test.pypi.org/legacy/
59+

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
[project]
22
name = "agrirouter"
3-
version = "2.0.0b1"
43
description = "Python SDK for the agrirouter API. This project contains the API for the communication with the agrirouter. Everything you need for the onboarding process, secure communication and much more."
54
authors = [
65
{ name = "Alexey Petrovsky", email = "petrovsky.lexey@gmail.com" },
@@ -26,10 +25,14 @@ dependencies = [
2625
"requests",
2726
"protobuf~=3.18.0"
2827
]
28+
dynamic = ["version"]
2929

3030
[build-system]
31-
requires = ["setuptools", "wheel"]
31+
requires = ["setuptools", "wheel", "setuptools-git-versioning>=2.0,<3"]
3232
build-backend = "setuptools.build_meta"
3333

3434
[tool.setuptools.dynamic]
3535
dependencies = { file = ["requirements.txt"] }
36+
37+
[tool.setuptools-git-versioning]
38+
enabled = true

0 commit comments

Comments
 (0)