Skip to content

Commit dec9f97

Browse files
committed
feat: add publish-to-test-pypi.yml
Signed-off-by: Milad Makdesi <milad@id8-engineering.io>
1 parent 1a8fcb4 commit dec9f97

2 files changed

Lines changed: 65 additions & 1 deletion

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: publish-to-test-pypi
2+
3+
on:
4+
push:
5+
branches: ["test_pypi"]
6+
7+
jobs:
8+
build:
9+
name: Build distribution
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
18+
with:
19+
python-version: "3.x"
20+
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
23+
24+
- name: Build distributions with uv
25+
run: uv build
26+
27+
- name: Upload distributions as artifact
28+
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
29+
with:
30+
name: dist-files
31+
path: dist/
32+
33+
publish-to-test-pypi:
34+
name: Publish Python distribution to TestPyPI
35+
needs: [build]
36+
runs-on: ubuntu-latest
37+
38+
environment:
39+
name: testpypi
40+
url: https://test.pypi.org/p/python-em511
41+
42+
permissions:
43+
id-token: write
44+
45+
steps:
46+
- name: Download all build artifacts
47+
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
48+
with:
49+
name: dist-files
50+
path: dist/
51+
52+
- name: Publish distribution to TestPyPI
53+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
54+
with:
55+
repository-url: https://test.pypi.org/legacy/
56+
user: __token__
57+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
58+
59+

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "python-em511"
3-
version = "0.0.1"
3+
version = "0.0.3"
44
description = "Driver for Carlo Gavazzi EM511 Series Single Phase Energy Meters using Modbus RTU"
55
readme = "README.md"
66

@@ -39,6 +39,9 @@ classifiers = [
3939
requires = ["hatchling"]
4040
build-backend = "hatchling.build"
4141

42+
[tool.hatch.build]
43+
sources = ["src"]
44+
4245
[tool.hatch.build.targets.wheel]
4346
packages = ["src/em511"]
4447

@@ -62,3 +65,5 @@ ignore = [
6265

6366
[tool.ruff.lint.pydocstyle]
6467
convention = "google"
68+
69+

0 commit comments

Comments
 (0)