Skip to content

Commit a392582

Browse files
committed
ci: Add package publication
1 parent 3813773 commit a392582

File tree

1 file changed

+46
-6
lines changed

1 file changed

+46
-6
lines changed

.github/workflows/main.yml

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,31 @@
1-
name: CI
1+
name: main
22

33
on: [push, pull_request, workflow_dispatch]
44

55
jobs:
66
build:
77
name: Build on ${{ matrix.os }}
88
runs-on: ${{ matrix.os }}
9+
permissions:
10+
contents: read
911
strategy:
1012
fail-fast: false
1113
matrix:
1214
os: [ubuntu-20.04, macos-10.15, windows-2019]
1315
version: [2.16.11]
14-
1516
steps:
1617
- uses: actions/checkout@v2
17-
1818
- uses: actions/setup-python@v2
19-
19+
- name: Create source dist
20+
run: python setup.py sdist
21+
- name: Upload source dist
22+
uses: actions/upload-artifact@v2
23+
with:
24+
name: dist
25+
path: dist
26+
if-no-files-found: error
2027
- name: Install cibuildwheel
2128
run: python -m pip install cibuildwheel==1.10.0
22-
2329
- name: Build and test wheels
2430
run: python -m cibuildwheel --output-dir wheelhouse
2531
env:
@@ -45,6 +51,40 @@ jobs:
4551
&& dir %LIB%
4652
CIBW_TEST_REQUIRES: -rrequirements/tests.txt
4753
CIBW_TEST_COMMAND: pytest {project}/tests
48-
4954
- name: Inventory
5055
run: ls wheelhouse
56+
- name: Upload wheels
57+
uses: actions/upload-artifact@v2
58+
with:
59+
name: wheels
60+
path: wheelhouse/
61+
if-no-files-found: error
62+
63+
publish:
64+
name: Publish packages
65+
runs-on: ubuntu-latest
66+
permissions:
67+
contents: read
68+
needs: build
69+
if: >
70+
github.event_name == 'push'
71+
&& startsWith(github.ref, 'refs/tags')
72+
&& github.repository == 'Synss/python-mbedtls'
73+
steps:
74+
- name: Download source packages
75+
uses: actions/download-artifact@v2
76+
with:
77+
name: dist
78+
path: dist
79+
- name: Download wheels
80+
uses: actions/download-artifact@v2
81+
with:
82+
name: wheels
83+
path: dist
84+
- name: List dir content
85+
run: ls dist
86+
- name: Publish to pypi
87+
uses: pypa/gh-action-pypi-publish@release/v1
88+
with:
89+
user: __token__
90+
password: ${{ secrets.PYPI_PASSWORD }}

0 commit comments

Comments
 (0)