-
Notifications
You must be signed in to change notification settings - Fork 2
60 lines (50 loc) · 1.91 KB
/
release.yml
File metadata and controls
60 lines (50 loc) · 1.91 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: "Release to PyPI & TestPyPI"
on:
release:
types:
- released
- prereleased
workflow_dispatch:
jobs:
build-and-publish:
name: Build Python distribution and publish to PyPI & TestPyPI
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Set the version metadata to the release tag
run: |
python .github/tools/check_metadata.py ${{ github.ref }}
# - name: PR for bumping version metadata
# uses: peter-evans/create-pull-request@v3
# with:
# author: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
# commit-message: "chore: bump version metadata for ${{ github.ref }}"
# title: "chore: bump version metadata for ${{ github.ref }}"
# body: The version metadata was not updated before release, it has been corrected when building dist, yet please update the code.
# branch: bump-version
# base: ${{ github.event.release.target_commitish }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install --upgrade setuptools wheel
pip install -r requirements.txt
- name: Build a binary wheel and a source tarball
run: |
python setup.py sdist bdist_wheel
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish to PyPI
if: ${{ github.event.action == 'released' || github.event_name == 'workflow_dispatch' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}