Skip to content

Commit c37ca59

Browse files
authored
Merge pull request #427 from NREL/publish_to_pypi
Replace deploy with trusted publisher workflow for pypi
2 parents d6969ea + bcf8eed commit c37ca59

File tree

3 files changed

+51
-33
lines changed

3 files changed

+51
-33
lines changed

.github/workflows/deploy.yaml

-33
This file was deleted.
+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish Python distribution to PyPI and TestPyPI
2+
3+
on: push
4+
5+
jobs:
6+
build:
7+
name: Build distribution
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Set up Python
13+
uses: actions/setup-python@v5
14+
with:
15+
python-version: "3.x"
16+
- name: Install pypa/build
17+
run: >-
18+
python3 -m
19+
pip install
20+
build
21+
--user
22+
- name: Build a binary wheel and a source tarball
23+
run: python3 -m build
24+
- name: Store the distribution packages
25+
uses: actions/upload-artifact@v4
26+
with:
27+
name: python-package-distributions
28+
path: dist/
29+
30+
publish-to-pypi:
31+
name: >-
32+
Publish Python distribution to PyPI
33+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
34+
needs:
35+
- build
36+
runs-on: ubuntu-latest
37+
environment:
38+
name: pypi
39+
url: https://pypi.org/p/rdtools
40+
permissions:
41+
id-token: write # IMPORTANT: mandatory for trusted publishing
42+
43+
steps:
44+
- name: Download all the dists
45+
uses: actions/download-artifact@v4
46+
with:
47+
name: python-package-distributions
48+
path: dist/
49+
- name: Publish distribution to PyPI
50+
uses: pypa/gh-action-pypi-publish@release/v1

docs/sphinx/source/changelog/pending.rst

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Enhancements
2323
Bug fixes
2424
---------
2525
* Fix typos in citation section of the readme file (:issue:`414`, :pull:`421`)
26+
* Fix deploy workflow to pypi (:issue:`416`, :pull:`427`)
2627

2728
Requirements
2829
------------

0 commit comments

Comments
 (0)