Skip to content

Commit 672a25e

Browse files
committed
ci: add PyPI publishing workflow with setuptools-scm versioning
Add GitHub Actions workflow for automated package publishing to PyPI and TestPyPI using trusted publishing (OIDC). Tagged releases trigger publication to PyPI, while all main branch pushes publish to TestPyPI for testing. Switch from static versioning to dynamic version management using setuptools-scm, which derives version numbers from git tags. This ensures package versions stay synchronized with release tags. Changes: - Add .github/workflows/publish-to-pypi.yml for CI/CD publishing - Update pyproject.toml to use setuptools-scm for dynamic versioning - Add amitools-amifuse[vamos] as an explicit dependency - Update amitools submodule to latest commit - Add BFFSFilesystem to .gitignore
1 parent d18a29e commit 672a25e

File tree

4 files changed

+90
-4
lines changed

4 files changed

+90
-4
lines changed
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags: ['v*']
7+
8+
jobs:
9+
build:
10+
name: Build distribution 📦
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v6
15+
with:
16+
persist-credentials: false
17+
fetch-depth: 0 # Required for setuptools-scm to find tags
18+
- name: Set up Python
19+
uses: actions/setup-python@v6
20+
with:
21+
python-version: "3.x"
22+
23+
- name: Install pypa/build
24+
run: >-
25+
python3 -m
26+
pip install
27+
build
28+
--user
29+
- name: Build a binary wheel and a source tarball
30+
run: python3 -m build
31+
- name: Store the distribution packages
32+
uses: actions/upload-artifact@v5
33+
with:
34+
name: python-package-distributions
35+
path: dist/
36+
37+
publish-to-pypi:
38+
name: >-
39+
Publish Python 🐍 distribution 📦 to PyPI
40+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
41+
needs:
42+
- build
43+
runs-on: ubuntu-latest
44+
environment:
45+
name: pypi
46+
url: https://pypi.org/p/amifuse
47+
permissions:
48+
id-token: write # IMPORTANT: mandatory for trusted publishing
49+
50+
steps:
51+
- name: Download all the dists
52+
uses: actions/download-artifact@v6
53+
with:
54+
name: python-package-distributions
55+
path: dist/
56+
- name: Publish distribution 📦 to PyPI
57+
uses: pypa/gh-action-pypi-publish@release/v1
58+
59+
publish-to-testpypi:
60+
name: Publish Python 🐍 distribution 📦 to TestPyPI
61+
needs:
62+
- build
63+
runs-on: ubuntu-latest
64+
65+
environment:
66+
name: testpypi
67+
url: https://test.pypi.org/p/amifuse
68+
69+
permissions:
70+
id-token: write # IMPORTANT: mandatory for trusted publishing
71+
72+
steps:
73+
- name: Download all the dists
74+
uses: actions/download-artifact@v6
75+
with:
76+
name: python-package-distributions
77+
path: dist/
78+
- name: Publish distribution 📦 to TestPyPI
79+
uses: pypa/gh-action-pypi-publish@release/v1
80+
with:
81+
repository-url: https://test.pypi.org/legacy/
82+

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ attic/
44
mnt/
55
*.hdf
66
*.adf
7-
SmartFileSystem
7+
BFFSFilesystem
88
FastFileSystem
9+
SmartFileSystem
910
pfs3aio

amitools

pyproject.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[build-system]
2-
requires = ["setuptools>=61.0"]
2+
requires = ["setuptools>=61.0", "setuptools-scm>=8"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "amifuse"
7-
version = "0.1.0"
7+
dynamic = ["version"]
88
description = "Mount Amiga filesystem images via FUSE using native AmigaOS handlers"
99
readme = "README.md"
1010
requires-python = ">=3.9"
@@ -25,6 +25,7 @@ classifiers = [
2525

2626
dependencies = [
2727
"fusepy>=3.0",
28+
"amitools-amifuse[vamos]",
2829
]
2930

3031
[project.scripts]
@@ -37,3 +38,5 @@ Homepage = "https://github.com/reinauer/amifuse"
3738

3839
[tool.setuptools.packages.find]
3940
include = ["amifuse*"]
41+
42+
[tool.setuptools_scm]

0 commit comments

Comments
 (0)