Skip to content

Commit 690a756

Browse files
committed
Add deployment to CI
1 parent 0e7b2f1 commit 690a756

File tree

1 file changed

+33
-9
lines changed

1 file changed

+33
-9
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,8 @@ jobs:
2323
- name: Upload source distribution
2424
uses: actions/upload-artifact@v3
2525
with:
26-
name: sdist
27-
path: "dist/*.tar.gz"
28-
if-no-files-found: error
29-
- name: Upload wheel
30-
uses: actions/upload-artifact@v3
31-
with:
32-
name: wheel
33-
path: "dist/*.whl"
26+
name: build-output
27+
path: "dist/*"
3428
if-no-files-found: error
3529

3630
test:
@@ -74,7 +68,7 @@ jobs:
7468
- name: Download wheel
7569
uses: actions/download-artifact@v3
7670
with:
77-
name: wheel
71+
name: build-output
7872
path: dist/
7973

8074
- name: Install wheel
@@ -85,3 +79,33 @@ jobs:
8579
- name: Test with pytest
8680
run: |
8781
pytest
82+
83+
deploy:
84+
runs-on: ubuntu-latest
85+
needs: [build, test]
86+
87+
steps:
88+
- name: Download artifacts
89+
uses: actions/download-artifact@v3
90+
with:
91+
name: build-output
92+
path: dist/
93+
94+
- name: Deploy to Test PyPI
95+
uses: pypa/gh-action-pypi-publish@release/v1
96+
if: startsWith(github.ref, 'refs/head/master')
97+
with:
98+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
99+
repository_url: https://test.pypi.org/legacy/
100+
101+
- name: Release
102+
uses: softprops/action-gh-release@v1
103+
if: startsWith(github.ref, 'refs/tags/v')
104+
with:
105+
files: dist/*
106+
107+
- name: Deploy to PyPI
108+
uses: pypa/gh-action-pypi-publish@release/v1
109+
if: startsWith(github.ref, 'refs/tags/v')
110+
with:
111+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)