Skip to content

Commit 4e3fd1f

Browse files
committed
ci: Publish distribution files to PyPI
Add steps to publish distribution files to PyPI when a tag is created. Signed-off-by: Leandro Lucarella <[email protected]>
1 parent 5552736 commit 4e3fd1f

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,49 @@ jobs:
3232
- name: run nox
3333
run: nox
3434
timeout-minutes: 10
35+
36+
build-dist:
37+
runs-on: ubuntu-20.04
38+
steps:
39+
- name: Fetch sources
40+
uses: actions/checkout@v3
41+
with:
42+
submodules: true
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@v4
46+
with:
47+
python-version: "3.10"
48+
49+
- name: Install build dependencies
50+
run: |
51+
python -m pip install -U pip
52+
python -m pip install -U build
53+
54+
- name: Build the source and binary distribution
55+
run: python -m build
56+
57+
- name: Upload dist files
58+
uses: actions/upload-artifact@v3
59+
with:
60+
name: frequenz-channels-python-dist
61+
path: dist/
62+
if-no-files-found: error
63+
64+
publish-to-pypi:
65+
needs: ["test", "build-dist"]
66+
# Publish only on tags creation
67+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
68+
runs-on: ubuntu-20.04
69+
steps:
70+
- name: Download dist files
71+
uses: actions/download-artifact@v3
72+
with:
73+
name: frequenz-channels-python-dist
74+
75+
- name: Publish the Python distribution to PyPI
76+
uses: pypa/gh-action-pypi-publish@release/v1
77+
with:
78+
password: ${{ secrets.PYPI_API_TOKEN }}
79+
packages_dir: ./
80+
skip_existing: true

0 commit comments

Comments
 (0)