File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : publish-to-test-pypi
2+
3+ on :
4+ push :
5+ branches : ["publish_testpypi"]
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+ with :
16+ fetch-depth : 0
17+
18+ - name : Set up Python
19+ uses : actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c
20+ with :
21+ python-version : " 3.x"
22+
23+ - name : Install uv
24+ uses : astral-sh/setup-uv@85856786d1ce8acfbcc2f13a5f3fbd6b938f9f41 # v7.1.2
25+
26+ - name : Install hatch
27+ run : uv tool install hatch
28+
29+ - name : Inject unique build tag into VERSION file
30+ run : |
31+ BASE_VERSION=$(cat VERSION)
32+ BUILD=".dev${{ github.run_id }}${{ github.run_number }}${{ github.run_attempt }}"
33+ echo "${BASE_VERSION}${BUILD}" > VERSION
34+
35+ - name : Build distributions with uv
36+ run : uv build --wheel
37+
38+ - name : Upload distributions as artifact
39+ uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
40+ with :
41+ name : python-package-distributions-${{ github.run_id }}
42+ path : dist/
43+
44+ publish-to-test-pypi :
45+ name : Publish Python distribution to TestPyPI
46+ needs : [build]
47+ runs-on : ubuntu-latest
48+
49+ environment :
50+ name : testpypi
51+ url : https://test.pypi.org/p/python-dcm230
52+
53+ permissions :
54+ id-token : write
55+
56+ steps :
57+ - name : Download all build artifacts
58+ uses : actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
59+ with :
60+ name : python-package-distributions-${{ github.run_id }}
61+ path : dist/
62+
63+ - name : Publish to TestPyPI
64+ uses : pypa/gh-action-pypi-publish@release/v1
65+ with :
66+ repository-url : https://test.pypi.org/legacy/
67+ verbose : true
Original file line number Diff line number Diff line change 1+ 0.0.1
Original file line number Diff line number Diff line change 11[project ]
22name = " python-dcm230"
3- version = " 0.0.1 "
3+ dynamic = [ " version " ]
44description = " Driver for Eastron DCM230 DC energy Meters using Modbus RTU"
55readme = " README.md"
66
@@ -42,6 +42,11 @@ build-backend = "hatchling.build"
4242[tool .hatch .build .targets .wheel ]
4343packages = [" src/dcm230" ]
4444
45+ [tool .hatch .version ]
46+ source = " regex"
47+ path = " VERSION"
48+ pattern = " (?P<version>.*)"
49+
4550[dependency-groups ]
4651dev = [
4752 " pre-commit>=4.3.0" ,
You can’t perform that action at this time.
0 commit comments