jimaku-dl/.github/workflows/publish-pypi.yml
sudacode ad11faf1b0
Some checks failed
Tests / test (ubuntu-latest, 3.8) (push) Failing after 24m2s
Tests / test (ubuntu-latest, 3.10) (push) Failing after 24m4s
Tests / test (ubuntu-latest, 3.9) (push) Failing after 10m52s
Tests / test (macos-latest, 3.10) (push) Has been cancelled
Tests / test (macos-latest, 3.8) (push) Has been cancelled
Tests / test (macos-latest, 3.9) (push) Has been cancelled
Tests / test (windows-latest, 3.10) (push) Has been cancelled
Tests / test (windows-latest, 3.8) (push) Has been cancelled
Tests / test (windows-latest, 3.9) (push) Has been cancelled
update
2025-03-08 23:52:40 -08:00

64 lines
1.7 KiB
YAML

name: Publish to PyPI
on:
release:
types: [published, released]
workflow_dispatch:
inputs:
skip_release_check:
description: "Skip release check (use current version in files)"
required: false
default: false
type: boolean
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.release.tag_name }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
pip install -e .
- name: Verify version matches release tag
if: github.event_name == 'release' && !inputs.skip_release_check
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/}
TAG_VERSION=${TAG_VERSION#v}
CODE_VERSION=$(grep -E "__version__\s*=\s*['\"]([^'\"]+)['\"]" src/jimaku_dl/__init__.py | cut -d'"' -f2)
echo "Tag version: $TAG_VERSION"
echo "Code version: $CODE_VERSION"
if [ "$TAG_VERSION" != "$CODE_VERSION" ]; then
echo "Error: Version mismatch between tag ($TAG_VERSION) and code ($CODE_VERSION)"
exit 1
fi
echo "Version verified: $CODE_VERSION"
- name: Build package
run: python -m build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true