2020-08-11 12:46:02 +00:00
|
|
|
|
name: Upload Python Package
|
|
|
|
|
|
|
|
|
|
on:
|
|
|
|
|
# 当master分支有push时,触发action
|
2020-08-11 14:15:47 +00:00
|
|
|
|
#push:
|
|
|
|
|
#branches:
|
|
|
|
|
#- master
|
2020-08-11 12:46:02 +00:00
|
|
|
|
|
|
|
|
|
# 当一个pr被合并到master时,触发action
|
2020-08-11 14:15:47 +00:00
|
|
|
|
#pull_request:
|
|
|
|
|
#branches:
|
|
|
|
|
#- master
|
2020-08-11 12:46:02 +00:00
|
|
|
|
|
|
|
|
|
# 当发布时,触发action
|
2020-08-11 14:15:47 +00:00
|
|
|
|
release:
|
|
|
|
|
types: [created]
|
2020-08-11 12:46:02 +00:00
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
build:
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
strategy:
|
|
|
|
|
matrix:
|
2020-08-11 14:15:47 +00:00
|
|
|
|
python-version: ["3.6"]
|
2020-08-11 12:46:02 +00:00
|
|
|
|
steps:
|
|
|
|
|
# 此步骤使用 GitHub 的 https://github.com/actions/checkout
|
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
|
|
# 设置python环境
|
|
|
|
|
# 此步骤使用 GitHub 的 https://github.com/actions/setup-python
|
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
|
|
|
uses: actions/setup-python@v2
|
2020-08-11 12:52:45 +00:00
|
|
|
|
with:
|
|
|
|
|
python-version: ${{ matrix.python-version }}
|
2020-08-11 14:15:47 +00:00
|
|
|
|
|
2020-08-11 12:46:02 +00:00
|
|
|
|
# 安装依赖
|
|
|
|
|
- name: Install dependencies
|
|
|
|
|
run: |
|
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
|
pip install setuptools wheel twine
|
|
|
|
|
|
|
|
|
|
# 构建和发布
|
|
|
|
|
- name: Build and publish
|
|
|
|
|
env:
|
|
|
|
|
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
|
|
|
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
|
|
|
|
|
run: |
|
|
|
|
|
python setup.py sdist bdist_wheel
|
|
|
|
|
twine upload dist/*
|