Skip to content

Commit 6e84f5f

Browse files
authored
Publish to PyPi using a GH action (#27)
* Test GH action * Trigger manually * Quick fix
1 parent ec508cd commit 6e84f5f

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Upload Python Package
2+
3+
on:
4+
workflow_dispatch: # Enables manual triggering of the workflow
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
release-build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Python
18+
uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.9"
21+
22+
- name: Install build tools
23+
env:
24+
SB_API_KEY: ${{ secrets.SB_API_KEY }}
25+
run: |
26+
export PYPI_REGISTRY=https://$SB_API_KEY.pypimirror.stablebuild.com/2023-12-27/
27+
curl https://$SB_API_KEY.httpcache.stablebuild.com/pip-cache-20231228/https://bootstrap.pypa.io/get-pip.py -o get-pip.py && \
28+
python get-pip.py -i $PYPI_REGISTRY "pip==21.3.1" && \
29+
rm get-pip.py
30+
python -m pip install -i https://$SB_API_KEY.pypimirror.stablebuild.com/2023-01-30/ twine
31+
32+
- name: Build package
33+
run: |
34+
rm -rf build/
35+
rm -rf dist/
36+
python setup.py sdist
37+
38+
- name: Publish package
39+
env:
40+
TWINE_USERNAME: __token__
41+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
42+
run: |
43+
python -m twine upload dist/*

0 commit comments

Comments
 (0)