Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pypi trusted publishing #314

Merged
merged 26 commits into from
Oct 10, 2024
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/
Loading