Skip to content

Commit 0fe0d8b

Browse files
committed
ci: build releases in pypi
Based on https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ Testing only the build part for the time being, pypi upload will come in a second step
1 parent d0eeab1 commit 0fe0d8b

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/tests.yml

+32
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ on:
33
branches:
44
- main
55
- develop
6+
release:
7+
types: [created]
68
pull_request:
9+
workflow_dispatch:
710

811
jobs:
912
tests:
@@ -241,3 +244,32 @@ jobs:
241244
run: |
242245
export PATH=~/castxml/bin:$PATH
243246
pytest tests
247+
248+
build-release:
249+
name: Build distribution 📦
250+
if: (github.event_name == 'release' && github.event.action == 'created') || (github.event_name == 'workflow_dispatch')
251+
needs: tests
252+
runs-on: ubuntu-latest
253+
254+
steps:
255+
- uses: actions/checkout@v4
256+
with:
257+
persist-credentials: false
258+
- name: Set up Python
259+
uses: actions/setup-python@v5
260+
with:
261+
python-version: "3.x"
262+
263+
- name: Install pypa/build
264+
run: >-
265+
python3 -m
266+
pip install
267+
build
268+
--user
269+
- name: Build a binary wheel and a source tarball
270+
run: python3 -m build
271+
- name: Store the distribution packages
272+
uses: actions/upload-artifact@v4
273+
with:
274+
name: python-package-distributions
275+
path: dist/

0 commit comments

Comments
 (0)