Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: PyPI publish

on:
pull_request:
paths:
- '.github/workflows/pypi.yaml'
push:
tags:
- 'v*.*.*'


jobs:
build:
name: Build and validate distributions
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Build and validate wheel and sdist
uses: level12/coppy/gh-actions/nox-run@main
env:
PALS_DIST_DIR: dist
with:
nox-session: build

- name: Upload validated distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/
if-no-files-found: error

publish:
name: Publish distributions to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest

environment:
name: pypi-publish
url: https://pypi.org/p/pals

permissions:
id-token: write

steps:
- name: Download validated distributions
uses: actions/download-artifact@v5
with:
name: release-dists
path: dist/

- name: Publish distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
11 changes: 3 additions & 8 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ def audit(session: nox.Session):

@nox.session
def build(session: nox.Session):
uv_sync(session, 'build', 'pytest')
output_dir = Path(session.create_tmp()) / 'dist'
uv_sync(session, 'build')
output_dir = Path(environ.get('PALS_DIST_DIR', Path(session.create_tmp()) / 'dist'))
session.run('python', '-m', 'build', '--outdir', output_dir)
session.run('twine', 'check', *output_dir.glob('*'))
(wheel_path,) = output_dir.glob('*.whl')
Expand All @@ -58,12 +58,7 @@ def build(session: nox.Session):
session.run(
'python',
'-c',
'import pals; print(f"Testing installed wheel at {pals.__file__}")',
)
session.run(
'pytest',
'-q',
package_path / 'tests/pals_tests/test_core.py::TestLocker',
'import pals; print(f"Imported installed wheel from {pals.__file__}")',
)


Expand Down
Loading