Skip to content

Commit 982dad7

Browse files
authored
Update python-publish.yml
1 parent e9c4f08 commit 982dad7

File tree

1 file changed

+35
-42
lines changed

1 file changed

+35
-42
lines changed

.github/workflows/python-publish.yml

Lines changed: 35 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,44 @@
11
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
22

3-
on: push
3+
on:
4+
push:
5+
branches:
6+
- main # Adjust this to your default or deployment branch
47

58
jobs:
69
build-n-publish:
7-
name: Build and publish Python 🐍 distributions 📦 to PyPI
10+
name: Build, Test, and Publish
811
runs-on: ubuntu-latest
12+
913
steps:
10-
- name: astral-sh/setup-uv
11-
# You may pin to the exact commit or the version.
12-
# uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb
14+
- name: Checkout Repository
15+
uses: actions/checkout@v3
16+
17+
- name: Setup UV
1318
uses: astral-sh/[email protected]
1419
with:
15-
# The version of uv to install e.g., `0.5.0` Defaults to the version in pyproject.toml or 'latest'.
16-
version: # optional, default is
17-
# The version of Python to set UV_PYTHON to
18-
python-version: # optional
19-
# Use uv venv to activate a venv ready to be used by later steps.
20-
activate-environment: # optional, default is false
21-
# The directory to execute all commands in and look for files such as pyproject.toml
22-
working-directory: # optional, default is ${{ github.workspace }}
23-
# Used to increase the rate limit when retrieving versions and downloading uv.
24-
github-token: # optional, default is ${{ github.token }}
25-
# # Enable uploading of the uv cache
26-
# enable-cache: # optional, default is auto
27-
# # Glob pattern to match files relative to the repository root to control the cache.
28-
# cache-dependency-glob: # optional, default is **/*requirements*.txt
29-
# **/*constraints*.txt
30-
# **/*constraints*.in
31-
# **/pyproject.toml
32-
# **/uv.lock
33-
- name: Build Project
34-
run: uv build
35-
36-
# - uses: actions/checkout@master
37-
# - name: Set up Python 3.8
38-
# uses: actions/setup-python@v1
39-
# with:
40-
# python-version: 3.8
41-
# - name: Install pypa/build
42-
# run: python -m pip install build --user
43-
# - name: Build a binary wheel and a source tarball
44-
# run: python -m build --sdist --wheel --outdir dist/ .
45-
# - name: Publish distribution 📦 to Test PyPI
46-
# uses: pypa/gh-action-pypi-publish@master
47-
# with:
48-
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
49-
# repository_url: https://test.pypi.org/legacy/
50-
# skip_existing: true
51-
20+
version: latest
21+
activate-environment: true
22+
github-token: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Install Dependencies
25+
run: uv sync --with dev
26+
27+
- name: Run Tests
28+
run: uv run pytest
29+
30+
- name: Build Project
31+
run: uv build
32+
33+
- name: Publish to TestPyPI
34+
uses: pypa/gh-action-pypi-publish@release/v1
35+
with:
36+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
37+
repository-url: https://test.pypi.org/legacy/
38+
skip-existing: true
39+
40+
# Optional: Publish to PyPI (uncomment to enable)
41+
# - name: Publish to PyPI
42+
# uses: pypa/gh-action-pypi-publish@release/v1
43+
# with:
44+
# password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)