-
Notifications
You must be signed in to change notification settings - Fork 39
32 lines (31 loc) · 958 Bytes
/
deploy.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
name: Publish to PyPI
on:
pull_request:
branches: [main]
types: [closed]
workflow_dispatch:
inputs:
version_no:
description: 'Release Version:'
required: true
jobs:
deploy:
name: Publish to PyPI
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
steps:
- name: checkout
uses: actions/checkout@v4
- name: Update setup.py if manual release
if: github.event_name == 'workflow_dispatch'
run: |
sed -i "s/version='[0-9]\{1,2\}.[0-9]\{1,4\}.[0-9]\{1,4\}',/version='${{github.event.inputs.version_no}}',/g" setup.py
- name: Create packages
run: |
python setup.py sdist
python setup.py bdist_wheel
- name: pypi-publish
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}