Skip to content

Commit 8cfeeb4

Browse files
committed
Add new publish workflow [skip ci]
1 parent 8885980 commit 8cfeeb4

File tree

1 file changed

+46
-11
lines changed

1 file changed

+46
-11
lines changed

.github/workflows/publish.yaml

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,53 @@
1+
name: Publish Python 🐍 distribution 📦 to PyPI
12

2-
name: Publish to PyPI.org
33
on:
44
release:
55
types: [published]
6+
67
jobs:
7-
pypi:
8+
build:
9+
name: Build distribution 📦
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
persist-credentials: false
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.x"
20+
- name: Install pypa/build
21+
run: >-
22+
python3 -m
23+
pip install
24+
build
25+
--user
26+
- name: Build a binary wheel and a source tarball
27+
run: python3 -m build
28+
- name: Store the distribution packages
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: python-package-distributions
32+
path: dist/
33+
34+
publish-to-pypi:
35+
name: >-
36+
Publish Python 🐍 distribution 📦 to PyPI
37+
needs:
38+
- build
839
runs-on: ubuntu-latest
40+
environment:
41+
name: pypi
42+
url: https://pypi.org/p/bayesflow # Replace <package-name> with your PyPI project name
43+
permissions:
44+
id-token: write # IMPORTANT: mandatory for trusted publishing
45+
946
steps:
10-
- name: Checkout
11-
uses: actions/checkout@v4
12-
with:
13-
fetch-depth: 0
14-
- run: python3 -m pip install -U build && python3 -m build
15-
- name: Publish package
16-
uses: pypa/gh-action-pypi-publish@release/v1
17-
with:
18-
password: ${{ secrets.PYPI_API_TOKEN }}
47+
- name: Download all the dists
48+
uses: actions/download-artifact@v4
49+
with:
50+
name: python-package-distributions
51+
path: dist/
52+
- name: Publish distribution 📦 to PyPI
53+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)