-
Notifications
You must be signed in to change notification settings - Fork 65
55 lines (48 loc) · 1.31 KB
/
publish-to-pypi.yml
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
name: Publish to PyPI
on:
workflow_run:
workflows:
- Tests
types:
- completed
branches:
- main
workflow_dispatch:
jobs:
autotag:
name: Create tag if the commit has new version implemented
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
outputs:
tagcreated: ${{ steps.autotag.outputs.tagcreated }}
steps:
- uses: actions/checkout@v3
- name: Autotag
id: autotag
uses: butlerlogic/[email protected]
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
strategy: regex
root: "oml/__init__.py"
regex_pattern: >
^__version__ = ['"]([^'"]*)['"]
tag_prefix: "release."
build_and_publish_to_pypi:
name: Build and publish Python distribution to PyPI
needs: autotag
if: ${{ needs.autotag.outputs.tagcreated == 'yes' }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8.0"
- name: Build a binary wheel
run: |
make build_wheel
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}