Skip to content

发布正式包

发布正式包 #46

# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
# action的名称
name: 发布正式包
on:
# 当master分支有push时,触发action
#push:
# branches:
# - master
# 当一个pr被合并到master时,触发action
#pull_request:
# branches:
# - master
# 当发布时,触发action
release:
types: [created]
workflow_dispatch:
jobs:
build-n-publish:
name: Build and publish Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: out version
run:
python run_output_version.py
# 构建和发布
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}