Add utility function to replace urls (#9) #9
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
# This workflow will upload a Python Package using Twine when a release is created | |
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Upload Python Package | |
on: | |
push: | |
tags: | |
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10, v0.1.0.dev1 | |
permissions: | |
contents: read | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
- name: Install dependencies | |
run: | | |
uv pip install --system toml | |
- name: Extract version from tag and update pyproject.toml | |
run: | | |
# Get the version from the tag (remove 'v' prefix) | |
TAG_VERSION=${GITHUB_REF#refs/tags/v} | |
echo "Tag version: $TAG_VERSION" | |
# Update pyproject.toml with the version from the tag | |
python -c " | |
import toml | |
data = toml.load('pyproject.toml') | |
original_version = data['project']['version'] | |
data['project']['version'] = '$TAG_VERSION' | |
with open('pyproject.toml', 'w') as f: | |
toml.dump(data, f) | |
print(f'Version updated in pyproject.toml: {original_version} -> {data[\"project\"][\"version\"]}') | |
" | |
# Verify the change | |
cat pyproject.toml | grep version | |
- name: Build package | |
run: uv build --no-sources | |
- name: Publish package to PyPI | |
uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
verbose: true |