Skip to content

Commit 98806e2

Browse files
authored
Adds a Github Action workflow to publish to PyPi on creating a release in Github (#102)
1 parent 275231e commit 98806e2

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

.github/workflows/build.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build and upload to PyPI
2+
3+
on:
4+
release:
5+
types: [ published ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build_dist:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Set up Python
15+
uses: actions/setup-python@v3
16+
with:
17+
python-version: '3.x'
18+
- name: Install dependencies
19+
run: |
20+
python -m pip install --upgrade pip
21+
pip install build
22+
- name: Build package
23+
run: python -m build
24+
- name: Save artifacts
25+
uses: actions/upload-artifact@v3
26+
with:
27+
name: paillier-dist
28+
path: ./dist
29+
30+
upload_pypi:
31+
needs: [build_dist]
32+
runs-on: ubuntu-latest
33+
34+
# upload to PyPI only on release
35+
if: github.event.release && github.event.action == 'published'
36+
steps:
37+
- uses: actions/download-artifact@v3
38+
with:
39+
name: paillier-dist
40+
path: dist
41+
42+
- uses: pypa/gh-action-pypi-publish@v1.4.2
43+
with:
44+
user: __token__
45+
password: ${{ secrets.PYPI_API_TOKEN }}

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: "ubuntu-latest"
1414
strategy:
1515
matrix:
16-
python-version: ["3.8", "3.9", "3.10"]
16+
python-version: ["3.7", "3.8", "3.9", "3.10"]
1717

1818
steps:
1919
- uses: actions/checkout@v3

0 commit comments

Comments
 (0)