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
56 changes: 56 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish to PyPI

on:
push:
tags:
- "v*"

jobs:
test:
uses: ./.github/workflows/test.yml
secrets: inherit
Comment on lines +9 to +11

publish:
needs: test

runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.13"

- uses: astral-sh/setup-uv@v6
with:
enable-cache: true

- name: Verify tag format
run: |
[[ "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]

- name: Verify package version
shell: bash
run: |
TAG="${GITHUB_REF_NAME#v}"

VERSION=$(uv version --short)

echo "Tag: $TAG"
echo "Version: $VERSION"

if [ "$TAG" != "$VERSION" ]; then
echo "::error::Git tag ($TAG) does not match package version ($VERSION)"
exit 1
fi

- run: uv sync

- run: uv build

- run: uv publish
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [main]
pull_request:
branches: [main]
workflow_call:

jobs:
test:
Expand Down Expand Up @@ -37,11 +38,13 @@ jobs:
enable-cache: true

- name: Cache huggingface
id: hf-cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.cache/huggingface
key: huggingface-${{ hashFiles('pyproject.toml') }}
restore-keys: huggingface-
restore-keys: |
huggingface-

- name: Ensure Hugging Face cache directories exist
run: |
Expand Down
Loading