Skip to content

Commit 95ad04a

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 95ad04a

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/tests.yml

+31
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ on:
33
branches:
44
- main
55
- develop
6+
release:
7+
types: [created]
68
pull_request:
79

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

0 commit comments

Comments
 (0)