File tree 1 file changed +19
-12
lines changed
1 file changed +19
-12
lines changed Original file line number Diff line number Diff line change 4
4
push :
5
5
tags :
6
6
- ' *'
7
+ workflow_dispatch :
8
+ inputs :
9
+ version :
10
+ description : ' Version to publish'
11
+ required : true
12
+ default : ' '
7
13
8
14
jobs :
9
15
build-n-publish :
10
16
name : Build and publish Python 🐍 distributions 📦 to PyPI
11
17
runs-on : ubuntu-latest
12
18
steps :
13
- - uses : actions/checkout@master
19
+ - uses : actions/checkout@v3
14
20
- name : Set up Python 3.10
15
21
uses : actions/setup-python@v3
16
22
with :
17
23
python-version : ' 3.10'
18
24
- name : Install pypa/setuptools
19
- run : >-
20
- python -m
21
- pip install wheel
22
- - name : Extract tag name
23
- id : tag
24
- run : echo ::set-output name=TAG_NAME::$(echo $GITHUB_REF | cut -d / -f 3)
25
+ run : python -m pip install wheel setuptools
26
+ - name : Extract tag name or use manual input
27
+ id : get_version
28
+ run : |
29
+ if [[ $GITHUB_REF == refs/tags/* ]]; then
30
+ echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
31
+ else
32
+ echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
33
+ fi
25
34
- name : Update version in setup.py
26
- run : >-
27
- sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g" setup.py
35
+ run : sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.get_version.outputs.VERSION }}/g" setup.py
28
36
- name : Build a binary wheel
29
- run : >-
30
- python setup.py sdist bdist_wheel
37
+ run : python setup.py sdist bdist_wheel
31
38
- name : Publish distribution 📦 to PyPI
32
- uses : pypa/gh-action-pypi-publish@master
39
+ uses : pypa/gh-action-pypi-publish@v1.8.10
33
40
with :
34
41
password : ${{ secrets.PYPI_API_TOKEN }}
You can’t perform that action at this time.
0 commit comments