-
Notifications
You must be signed in to change notification settings - Fork 16
37 lines (37 loc) · 1.09 KB
/
_upload-package.yml
File metadata and controls
37 lines (37 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
name: upload-package
on:
workflow_call:
secrets:
PYPI_TOKEN:
required: true
jobs:
upload:
name: Upload wheel and sdist
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compare tag and package version
run: |
TAG=${GITHUB_REF#refs/*/}
VERSION=$(grep -Po '(?<=version=")[^"]*' setup.py)
if [ "$TAG" != "$VERSION" ]; then
echo "Tag value and package version are different: ${TAG} != ${VERSION}"
exit 1
fi
- name: Download built distributions
uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.13
- name: Install build dependencies
run: pip install --no-cache-dir -U pip . twine
- name: Upload to PyPI
run: twine upload dist/*
env:
TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}