-
Notifications
You must be signed in to change notification settings - Fork 2
41 lines (32 loc) · 1.61 KB
/
python-publish.yml
File metadata and controls
41 lines (32 loc) · 1.61 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
38
39
40
41
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
name: Upload Python Package
on:
release:
types: [published] # Release yaratilganda ishga tushadi (published – to'liq chiqarilganda)
permissions:
id-token: write # Trusted publishing uchun kerak (token kerak emas)
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4 # Yangi versiya (v3 dan v4 ga)
- name: Set up Python
uses: actions/setup-python@v5 # Yangi versiya (v3 dan v5 ga), pyproject.toml dan versiyani o'qiydi
with:
python-version: '3.x' # 3.8+ ni qo'llab-quvvatlaydi, sizning requires-python >=3.8 ga mos
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel build # Setuptools ni yangilash (sening muammoing uchun muhim!)
- name: Build package
run: python -m build # pyproject.toml ga asoslanib quradi (sdist va wheel yaratadi)
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1 # Yangi versiya (master o'rniga release/v1)
env: # Bu qism trusted publishing uchun (API token kerak emas)
environment: pypi # Quyida tushuntirilgan
with:
repository-url: https://upload.pypi.org/legacy/ # TestPyPI uchun https://test.pypi.org/legacy/ qo'ying
# user va password ni olib tashlang – trusted publishing ishlatiladi