Skip to content

Commit 4da3da3

Browse files
LourensVeenSbte
authored andcommitted
Add continuous deployment workflow for PyPI publication
1 parent db3d5d8 commit 4da3da3

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

.github/workflows/cd.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
run-tests:
9+
name: Run tests to avoid a broken release
10+
uses: BIMAU/transiflow/.github/workflows/ci.yml@master
11+
12+
build:
13+
name: Build packages
14+
runs-on: ubuntu-latest
15+
needs:
16+
- run-tests
17+
18+
steps:
19+
- name: Set up Python 3.x
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '>=3.8,<4'
23+
24+
- name: Check out the source code
25+
uses: actions/checkout@v3
26+
27+
- name: Build a source package and a wheel
28+
run: python -m build .
29+
30+
- name: Upload packages as artifact
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: packages-for-pypi
34+
path: dist/
35+
36+
publish:
37+
name: Publish to PyPI
38+
runs-on: ubuntu-latest
39+
needs:
40+
- build
41+
42+
environment:
43+
name: pypi
44+
url: https://pypi.org/p/transiflow
45+
46+
permissions:
47+
id-token: write
48+
49+
steps:
50+
- name: Download artifact with packages
51+
uses: actions/download-artifact@v4
52+
with:
53+
name: packages-for-pypi
54+
path: dist/
55+
56+
- name: Publish to PyPI
57+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches: [ master ]
66
pull_request:
77
branches: [ master ]
8+
workflow_call:
89

910
jobs:
1011
build:

0 commit comments

Comments
 (0)