Merge pull request #56 from duolabmeng6/patch #527
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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] | |
jobs: | |
build-n-publish: | |
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
# 自动处理版本号 | |
- name: auto version | |
run: | |
python -m pip install PyGithub | |
- name: out version | |
run: | |
python run_tags_add.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/gh-action-pypi-publish@master | |
# with: | |
# password: ${{ secrets.PYPI_API_TOKEN }} | |
- name: Publish distribution 📦 to Test PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |