EXP-1213: Add GitHub Actions release automation#25
Conversation
…ignore - justfile: add missing 'install' recipe header (was a bare unindented command with no recipe name, breaking the whole file's parsing), and rename 'Build' -> 'build' to match idiomatic naming and the call site in release.yml. - pyproject.toml: fix 'requies' -> 'requires' typo (mandatory PEP 518 key) and 'setup-tools' -> 'setuptools' (correct PyPI package name). - release.yml: fix invalid YAML (missing space after 'uses:', and the 'Upload assets to release' step was mis-indented as a nested item under the previous step instead of a sibling step). - .gitignore: add .venv/ alongside the existing venv/ entry so the new uv-based tooling's virtualenv isn't accidentally committed.
| release: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 |
There was a problem hiding this comment.
| - uses: actions/checkout@v6 | |
| - uses: actions/checkout@v7 |
| - uses: actions/checkout@v6 | ||
| - uses: extractions/setup-just@v3 | ||
| - uses: astral-sh/setup-uv@v7 | ||
| - uses: actions/setup-python@v6 |
There was a problem hiding this comment.
| - uses: actions/setup-python@v6 | |
| - uses: actions/setup-python@v7 |
| @@ -0,0 +1,7 @@ | |||
| # Install the project and build its dependencies. | |||
| install: | |||
| uv pip install --system -e . -r requirements-tests.txt | |||
There was a problem hiding this comment.
Python project must use their own virtual environments to ensure that dependencies don't mix or conflict with other projects. Installing system-wide as written can create various problems, best to be avoided.
| uv pip install --system -e . -r requirements-tests.txt | |
| uv venv | |
| uv pip install -e . -r requirements-tests.txt |
There was a problem hiding this comment.
Note that you still need to remove the --system flag as that'll install them system-wide.
|
|
||
| # build sdist and wheel into dist/ | ||
| build: | ||
| uv build |
There was a problem hiding this comment.
praise: nice, TIL uv has a build command!
| 1. Bump the version in `setup.py` and `pystalk/__init__.py` to the stable version (e.g., `0.2`) | ||
| 1. Bump the version in `setup.py` and `pystalk/__init__.py` to the stable version (e.g., `0.9.0`) | ||
| 1. Update [`CHANGES.rst`](docs/source/CHANGES.rst) with the changes and the new version number | ||
| 1. Update [`conf.py`](docs/source/conf.py) with the new version number |
There was a problem hiding this comment.
this line isn't needed
| 1. Update [`conf.py`](docs/source/conf.py) with the new version number |
| @@ -0,0 +1,3 @@ | |||
| [build-system] | |||
There was a problem hiding this comment.
if we're committing to switching to uv over standard venv (which I'm fine with but wasn't intending to be included here), then we should convert the setup.py file to be in this pyproject.toml file to consolidate build metadata. You can use the easypost-python file as a template to follow. You'll then want to remove this repos setup.py file.
| 1. Push up to Github | ||
| 1. Upload to PyPI with `python setup.py sdist upload` | ||
| 1. Commit and push up to Github | ||
| 1. Draft a [new GitHub Release](https://github.com/EasyPost/pystalk/releases/new), targeting a new tag matching the version (e.g., `pystalk-0.9.0`) |
There was a problem hiding this comment.
versions don't include the name, not sure why that's suggested here.
| 1. Draft a [new GitHub Release](https://github.com/EasyPost/pystalk/releases/new), targeting a new tag matching the version (e.g., `pystalk-0.9.0`) | |
| 1. Draft a [new GitHub Release](https://github.com/EasyPost/pystalk/releases/new), targeting a new tag matching the version (e.g., `0.9.0`) |
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: extractions/setup-just@v3 | ||
| - uses: astral-sh/setup-uv@v7 | ||
| - uses: actions/setup-python@v7 | ||
| with: | ||
| python-version: '3.14' | ||
| - name: Build package | ||
| run: just install build | ||
| - name: Publish to PyPi | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| password: ${{ secrets.PYPI_API_TOKEN }} | ||
| - name: Upload assets to release | ||
| uses: AButler/upload-release-assets@v3.0.1 | ||
| with: | ||
| files: 'dist/*' | ||
| repo-token: ${{ secrets.GITHUB_TOKEN }} No newline at end of file |
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - uses: extractions/setup-just@v3 | ||
| - uses: actions/setup-python@v7 | ||
| with: | ||
| python-version: '3.14' | ||
| - name: Build package | ||
| run: just install build | ||
| - name: Publish to PyPi | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| password: ${{ secrets.PYPI_API_TOKEN }} | ||
| - name: Upload assets to release | ||
| uses: AButler/upload-release-assets@v3.0.1 | ||
| with: | ||
| files: 'dist/*' | ||
| repo-token: ${{ secrets.GITHUB_TOKEN }} No newline at end of file |
| dependencies = { file = ["requirements.txt"] } | ||
|
|
||
| [tool.setuptools.dynamic.optional-dependencies] | ||
| dev = { file = ["requirements-tests.txt"] } |
There was a problem hiding this comment.
suggestion: this works but we could consolidate one more level by moving the dependencies into this file instead of keeping a separate requirements file(s)
| python -m pip install --upgrade pip | ||
| python -m pip install -e . -r requirements-tests.txt |
There was a problem hiding this comment.
We first need to install a virtual environment (we can use the pip version that comes with that python interpreter) before we can install deps.
If we move the deps to the pyproject.toml file, we can then simplify to something like this:
| python -m pip install --upgrade pip | |
| python -m pip install -e . -r requirements-tests.txt | |
| python -m venv venv | |
| python -m pip install -e '.[dev]' |
|
|
||
| [project] | ||
| name = "pystalk" | ||
| description = "Beanstalkd" |
There was a problem hiding this comment.
This description should match the one in the README or github description for the repo (it should be a single sentence describing what it does).
This PR adds GitHub Actions–based release automation for pystalk: a new
.github/workflows/release.ymlthat builds the sdist/wheel (via a newjustfilewithinstall/buildtargets usinguv) and publishes to PyPI plus uploads release assets whenever a GitHub release is published, along with a minimalpyproject.tomlsetuptools build-system config, a.gitignoreentry for.venv/, and aREADME.mdupdate describing the new tag-and-publish release workflow in place of the old manualpython setup.py sdist uploadprocess.