Skip to content

Commit

Permalink
pypi trusted publishing (#314)
Browse files Browse the repository at this point in the history
* Update version number.

* Fix

* Correct tag ref

* Use BaseArgument.__eq__ in Argument (#147)

(cherry picked from commit e683148)

* Oops! Bump version number.

* Fix.

* Bump version.

* Updated to .md README (#275)

* Kebab case in build-wheels.yml (#276)

* Fixes for pypa packaging.

* Correct documentation links (#277)

* Remove unecessary pip pinning (#278)

* Bump version.

* Update version to 2024.2.0

* Try trusted publishing on pypi.

* Remove version change.

* Fix.

* Tidy.

* Simplify.

---------

Co-authored-by: Chris Richardson <[email protected]>
Co-authored-by: Michal Habera <[email protected]>
Co-authored-by: Garth N. Wells <[email protected]>
  • Loading branch information
4 people authored Oct 10, 2024
1 parent 2125dce commit 737cd7c
Showing 1 changed file with 33 additions and 17 deletions.
50 changes: 33 additions & 17 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ on:
default: "main"
type: string
test_pypi_publish:
description: "Publish to Test PyPi (true | false)"
description: "Publish to Test PyPi"
default: false
type: boolean
pypi_publish:
description: "Publish to PyPi (true | false)"
description: "Publish to PyPi"
default: false
type: boolean

Expand All @@ -26,11 +26,11 @@ on:
default: "main"
type: string
test_pypi_publish:
description: "Publish to Test PyPi (true | false)"
description: "Publish to Test PyPi"
default: false
type: boolean
pypi_publish:
description: "Publish to PyPi (true | false))"
description: "Publish to PyPi"
default: false
type: boolean

Expand All @@ -54,28 +54,44 @@ jobs:
with:
path: dist/*

upload_pypi:
name: Upload to PyPI (optional)
upload_test_pypi:
name: Upload to test PyPI (optional)
if: ${{ github.event.inputs.test_pypi_publish == 'true' }}
needs: [build]
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/fenics-ufl
permissions:
id-token: write

steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist

- name: Push to PyPI
- name: Push to test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ github.event.inputs.pypi_publish == 'true' }}
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
repository-url: https://upload.pypi.org/legacy/
repository-url: https://test.pypi.org/legacy/

upload_pypi:
name: Upload to PyPI (optional)
if: ${{ github.event.inputs.pypi_publish == 'true' }}
needs: [build]
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/fenics-ufl
permissions:
id-token: write

steps:
- uses: actions/download-artifact@v4
with:
name: artifact
path: dist

- name: Push to Test PyPI
- name: Push to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: ${{ github.event.inputs.test_pypi_publish == 'true' }}
with:
user: __token__
password: ${{ secrets.PYPI_TEST_TOKEN }}
repository-url: https://test.pypi.org/legacy/

0 comments on commit 737cd7c

Please sign in to comment.