Skip to content

Commit a245600

Browse files
moffa90claude
andcommitted
feat: add PyPI publishing workflow and fix license format
- Add GitHub Actions workflow for publishing to PyPI/TestPyPI - Use trusted publishing with OIDC (no API tokens needed) - Support manual workflow dispatch for TestPyPI testing - Auto-publish on GitHub releases - Fix license format to use SPDX expression 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 13905a9 commit a245600

2 files changed

Lines changed: 90 additions & 2 deletions

File tree

.github/workflows/publish.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
inputs:
8+
target:
9+
description: 'Target repository'
10+
required: true
11+
default: 'testpypi'
12+
type: choice
13+
options:
14+
- testpypi
15+
- pypi
16+
17+
jobs:
18+
build:
19+
name: Build distribution
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: "3.11"
29+
30+
- name: Install build dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install build twine
34+
35+
- name: Build package
36+
run: python -m build
37+
38+
- name: Check package with twine
39+
run: twine check dist/*
40+
41+
- name: Upload artifacts
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: dist-packages
45+
path: dist/
46+
47+
publish-testpypi:
48+
name: Publish to TestPyPI
49+
needs: build
50+
runs-on: ubuntu-latest
51+
if: github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'testpypi'
52+
environment:
53+
name: testpypi
54+
url: https://test.pypi.org/p/microchip-emc2305
55+
permissions:
56+
id-token: write
57+
58+
steps:
59+
- name: Download artifacts
60+
uses: actions/download-artifact@v4
61+
with:
62+
name: dist-packages
63+
path: dist/
64+
65+
- name: Publish to TestPyPI
66+
uses: pypa/gh-action-pypi-publish@release/v1
67+
with:
68+
repository-url: https://test.pypi.org/legacy/
69+
70+
publish-pypi:
71+
name: Publish to PyPI
72+
needs: build
73+
runs-on: ubuntu-latest
74+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'pypi')
75+
environment:
76+
name: pypi
77+
url: https://pypi.org/p/microchip-emc2305
78+
permissions:
79+
id-token: write
80+
81+
steps:
82+
- name: Download artifacts
83+
uses: actions/download-artifact@v4
84+
with:
85+
name: dist-packages
86+
path: dist/
87+
88+
- name: Publish to PyPI
89+
uses: pypa/gh-action-pypi-publish@release/v1

pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ readme = "README.md"
1010
authors = [
1111
{name = "Jose Luis Moffa", email = "moffa3@gmail.com"}
1212
]
13-
license = {text = "MIT"}
13+
license = "MIT"
1414
classifiers = [
1515
"Development Status :: 4 - Beta",
1616
"Intended Audience :: Developers",
1717
"Topic :: System :: Hardware :: Hardware Drivers",
1818
"Topic :: Software Development :: Embedded Systems",
19-
"License :: OSI Approved :: MIT License",
2019
"Programming Language :: Python :: 3",
2120
"Programming Language :: Python :: 3.9",
2221
"Programming Language :: Python :: 3.10",

0 commit comments

Comments
 (0)