Skip to content

Commit

Permalink
Merge pull request #427 from NREL/publish_to_pypi
Browse files Browse the repository at this point in the history
Replace deploy with trusted publisher workflow for pypi
  • Loading branch information
mdeceglie authored Aug 21, 2024
2 parents d6969ea + bcf8eed commit c37ca59
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 33 deletions.
33 changes: 0 additions & 33 deletions .github/workflows/deploy.yaml

This file was deleted.

50 changes: 50 additions & 0 deletions .github/workflows/publish-to-pypi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Publish Python distribution to PyPI and TestPyPI

on: push

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python distribution to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/rdtools
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
1 change: 1 addition & 0 deletions docs/sphinx/source/changelog/pending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Enhancements
Bug fixes
---------
* Fix typos in citation section of the readme file (:issue:`414`, :pull:`421`)
* Fix deploy workflow to pypi (:issue:`416`, :pull:`427`)

Requirements
------------
Expand Down

0 comments on commit c37ca59

Please sign in to comment.