Add PRESERVE_BUNDLES Environment Variable (#62) #10
Workflow file for this run
This file contains hidden or 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: Publish to PyPI | |
on: | |
push: | |
tags: | |
# Match SemVer tags without 'v' prefix (e.g., 1.0.0, 2.1.3) | |
- '[0-9]+.[0-9]+.[0-9]+' | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version to publish (e.g. 1.0.0)' | |
required: true | |
type: string | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract version from tag | |
id: version | |
run: | | |
if [ "${{ github.event_name }}" = "push" ]; then | |
VERSION=${GITHUB_REF#refs/tags/} | |
else | |
VERSION=${{ github.event.inputs.version }} | |
fi | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
echo "Publishing version: $VERSION" | |
- name: Update pyproject.toml version | |
run: | | |
sed -i 's/^version = .*/version = "${{ steps.version.outputs.version }}"/' pyproject.toml | |
echo "Updated pyproject.toml version to: ${{ steps.version.outputs.version }}" | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.13' | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
enable-cache: true | |
- name: Build package | |
run: uv build | |
- name: Publish to PyPI | |
env: | |
UV_PUBLISH_TOKEN: ${{ secrets.UV_PUBLISH_TOKEN }} | |
run: uv publish |