This project publishes Python distributions through GitHub Actions using PyPI Trusted Publishing.
The package name and version live here:
pyproject.tomlmacfw/__init__.py
Build locally before the first release:
python3 -m pip install --upgrade build twine
python3 -m build
twine check dist/*Create Trusted Publishers on both PyPI and TestPyPI.
PyPI:
- Owner:
tudoujunha - Repository:
macfw - Workflow:
publish-pypi.yml - Environment:
pypi
TestPyPI:
- Owner:
tudoujunha - Repository:
macfw - Workflow:
publish-testpypi.yml - Environment:
testpypi
The workflow files live in:
.github/workflows/publish-pypi.yml.github/workflows/publish-testpypi.yml
Use TestPyPI first when validating a new release pipeline.
- Push the current branch to GitHub.
- Open the
Publish TestPyPIworkflow in GitHub Actions. - Run it manually with
workflow_dispatch. - Confirm the package appears on TestPyPI.
- Test installation:
python3 -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple macfwAfter TestPyPI succeeds:
- Update the version in:
macfw/__init__.pypyproject.toml
- Commit the release version.
- Create and push a Git tag:
git tag -a v0.1.2 -m "macfw v0.1.2"
git push origin main
git push origin v0.1.2-
GitHub Actions will build the wheel and sdist, then publish to PyPI.
-
Verify the published package from PyPI:
python3 -m pip install --user pipx
pipx install macfw==0.1.2
macfw --version- The PyPI workflow publishes on tag pushes matching
v*. - The TestPyPI workflow is manual on purpose.
- If the package name is already taken on PyPI, publishing will fail until the name is changed.
- The recommended end-user install path is
pipx install macfw. - If you are already using
macfw, upgrade withpipx upgrade macfw.