Skip to content

Commit b1fc2d3

Browse files
Github Actions Workflow - Publish Python Packages To Pypi.
1 parent fcdf10e commit b1fc2d3

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/pypi-publish.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Publish Python Packages To Pypi
2+
on:
3+
workflow_dispatch:
4+
release:
5+
types: [created]
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-22.04
9+
steps:
10+
- uses: actions/checkout@v3
11+
- name: Set up Python
12+
uses: actions/setup-python@v3
13+
with:
14+
python-version: '3.10'
15+
- name: Install dependencies
16+
run: |
17+
python -m pip install --upgrade pip
18+
pip install setuptools wheel twine
19+
- name: Build packages
20+
run: |
21+
for each in $(find "${GITHUB_WORKSPACE}" -maxdepth 1 -mindepth 1 -type d -name "*sdk*")
22+
do
23+
cd "${each}" || exit 1
24+
python setup.py bdist_wheel
25+
cp dist/*.whl "${GITHUB_WORKSPACE}"
26+
done
27+
shell: bash
28+
- name: Publish packages
29+
run: |
30+
echo -e "[pypi]\nusername = __token__\npassword = ${PYPI_API_TOKEN}" >> "${HOME}/.pypirc"
31+
cd "${GITHUB_WORKSPACE}" || exit 1
32+
twine upload --repository pypi ./*.whl --skip-existing --verbose
33+
env:
34+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)