add uv.lock for deployment to community cloud #123
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'test/**' | |
jobs: | |
build-and-upload: | |
runs-on: ubuntu-latest | |
environment: pypi | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: 'pip' | |
- name: Install and configure uv | |
run: | | |
pip install uv | |
uv venv | |
source .venv/bin/activate | |
uv pip install build hatchling twine | |
- name: Build and check package | |
run: | | |
source .venv/bin/activate | |
rm -rf dist/ build/ src/*.egg-info/ | |
python -m build | |
twine check dist/* | |
- name: Upload to TestPyPI | |
if: contains(github.ref, 'refs/heads/test/') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
verify-metadata: true | |
skip-existing: true | |
- name: Upload to PyPI | |
if: github.ref == 'refs/heads/main' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
verify-metadata: true | |
skip-existing: true |