Skip to content

Commit

Permalink
Release automation (#52)
Browse files Browse the repository at this point in the history
* use setuptools-git-versioning to automate setting version

* first try to auto deploy to Test PyPi
  • Loading branch information
oliverrahner authored May 6, 2024
1 parent 31695c0 commit a5222a4
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Release

on:
push:
tags:
- v2.*

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
- name: Lint with flake8
run: |
flake8 .
- name: Test with pytest
run: |
pytest --junitxml=junit/test-results.xml
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: dist/

publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI
needs:
- build
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/agrirouter

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[project]
name = "agrirouter"
version = "2.0.0b1"
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."
authors = [
{ name = "Alexey Petrovsky", email = "[email protected]" },
Expand All @@ -26,10 +25,14 @@ dependencies = [
"requests",
"protobuf~=3.18.0"
]
dynamic = ["version"]

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

[tool.setuptools.dynamic]
dependencies = { file = ["requirements.txt"] }

[tool.setuptools-git-versioning]
enabled = true

0 comments on commit a5222a4

Please sign in to comment.