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

ci/python-publish: bump, use trusted publishing #2345

Merged
merged 21 commits into from
Nov 22, 2024
Merged
Changes from 1 commit
Commits
Show all changes
21 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
56 changes: 35 additions & 21 deletions ci/python-publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will upload a Python Package using Twine when a release is created
# This workflow will upload a Python Package to PyPI when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

woodruffw marked this conversation as resolved.
Show resolved Hide resolved
# This workflow uses actions that are not certified by GitHub.
Expand All @@ -12,28 +12,42 @@ on:
release:
types: [published]

permissions:
contents: read
woodruffw marked this conversation as resolved.
Show resolved Hide resolved

jobs:
deploy:
release-build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: build release distributions
run: |
woodruffw marked this conversation as resolved.
Show resolved Hide resolved
# NOTE: put your own distribution build steps here.
python -m pip install build
python -m build

woodruffw marked this conversation as resolved.
Show resolved Hide resolved
- name: upload distributions
uses: actions/upload-artifact@v4
woodruffw marked this conversation as resolved.
Show resolved Hide resolved
with:
name: release-dists
path: dist/

pypi-publish:
runs-on: ubuntu-latest
needs:
- release-build
permissions:
id-token: write
woodruffw marked this conversation as resolved.
Show resolved Hide resolved

woodruffw marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
woodruffw marked this conversation as resolved.
Show resolved Hide resolved
Loading