58 lines
1.8 KiB
YAML
58 lines
1.8 KiB
YAML
# SPDX-FileCopyrightText: 2025 Alexander Kalinovsky <a@k8y.ru>
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
name: Publish to PyPI
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
build-publish:
|
|
# Only run on stable releases (not alpha, beta, rc, dev)
|
|
# This workflow handles: v0.1.0, v1.0.0, v2.3.4, etc.
|
|
# IMPORTANT: This should be the ONLY workflow that runs for stable releases
|
|
if: "!contains(gitea.ref, 'rc') && !contains(gitea.ref, 'a') && !contains(gitea.ref, 'b') && !contains(gitea.ref, 'dev')"
|
|
|
|
permissions:
|
|
id-token: write
|
|
contents: read
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
env:
|
|
UV_INDEX_URL: https://pypi.org/simple/
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Debug release info
|
|
run: |
|
|
echo "🔍 Release Debug Information:"
|
|
echo "Tag/Ref: ${{ gitea.ref }}"
|
|
echo "Tag name: ${{ gitea.ref_name }}"
|
|
echo "Repository: ${{ gitea.repository }}"
|
|
echo "Event type: ${{ gitea.event_name }}"
|
|
echo "Workflow: Production PyPI"
|
|
|
|
echo ""
|
|
echo "📋 Condition Check:"
|
|
echo "Contains 'rc': ${{ contains(gitea.ref, 'rc') }}"
|
|
echo "Contains 'a': ${{ contains(gitea.ref, 'a') }}"
|
|
echo "Contains 'b': ${{ contains(gitea.ref, 'b') }}"
|
|
echo "Contains 'dev': ${{ contains(gitea.ref, 'dev') }}"
|
|
echo "Should run: ${{ !contains(gitea.ref, 'rc') && !contains(gitea.ref, 'a') && !contains(gitea.ref, 'b') && !contains(gitea.ref, 'dev') }}"
|
|
- name: Set up uv
|
|
uses: astral-sh/setup-uv@v5
|
|
with:
|
|
enable-cache: true
|
|
python-version: "3.13"
|
|
- name: Build wheel & sdist
|
|
run: |
|
|
uv build
|
|
- name: Publish (PyPI)
|
|
run: |
|
|
uv publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
|
|
|