Clean up workflow file

This commit is contained in:
Micha Albert 2025-02-17 17:25:01 -05:00
parent 2d0b25c16c
commit 6b40d533d2

156
.github/pypi.yml vendored
View file

@ -1,6 +1,8 @@
name: Publish Python distribution to PyPI and TestPyPI name: Publish Python distribution to PyPI and TestPyPI
on: push on:
- push
- workflow_dispatch
jobs: jobs:
build: build:
@ -8,96 +10,96 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
persist-credentials: false persist-credentials: false
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: "3.x" python-version: "3.x"
- name: Install pypa/build - name: Install pypa/build
run: >- run: >-
python3 -m python3 -m
pip install pip install
build build
--user --user
- name: Build a binary wheel and a source tarball - name: Build a binary wheel and a source tarball
run: python3 -m build run: python3 -m build
- name: Store the distribution packages - name: Store the distribution packages
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: python-package-distributions name: python-package-distributions
path: dist/ path: dist/
publish-to-pypi: publish-to-pypi:
name: >- name: >-
Publish Python 🐍 distribution 📦 to PyPI Publish Python distribution to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs: needs:
- build - build
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: environment:
name: pypi name: pypi
url: https://pypi.org/p/highlight-video-maker url: https://pypi.org/p/highlight-video-maker
permissions: permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing id-token: write # IMPORTANT: mandatory for trusted publishing
steps: steps:
- name: Download all the dists - name: Download all the dists
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: python-package-distributions name: python-package-distributions
path: dist/ path: dist/
- name: Publish distribution 📦 to PyPI - name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1 uses: pypa/gh-action-pypi-publish@release/v1
github-release: github-release:
name: >- name: >-
Sign the Python 🐍 distribution 📦 with Sigstore Sign the Python distribution with Sigstore
and upload them to GitHub Release and upload them to GitHub Release
needs: needs:
- publish-to-pypi - publish-to-pypi
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore id-token: write # IMPORTANT: mandatory for sigstore
steps: steps:
- name: Download all the dists - name: Download all the dists
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: python-package-distributions name: python-package-distributions
path: dist/ path: dist/
- name: Sign the dists with Sigstore - name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v3.0.0 uses: sigstore/gh-action-sigstore-python@v3.0.0
with: with:
inputs: >- inputs: >-
./dist/*.tar.gz ./dist/*.tar.gz
./dist/*.whl ./dist/*.whl
- name: Create GitHub Release - name: Create GitHub Release
env: env:
GITHUB_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ github.token }}
run: >- run: >-
gh release create gh release create
"$GITHUB_REF_NAME" "$GITHUB_REF_NAME"
--repo "$GITHUB_REPOSITORY" --repo "$GITHUB_REPOSITORY"
--notes "" --notes ""
- name: Upload artifact signatures to GitHub Release - name: Upload artifact signatures to GitHub Release
env: env:
GITHUB_TOKEN: ${{ github.token }} GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI. # Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the # `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates. # sigstore-produced signatures and certificates.
run: >- run: >-
gh release upload gh release upload
"$GITHUB_REF_NAME" dist/** "$GITHUB_REF_NAME" dist/**
--repo "$GITHUB_REPOSITORY" --repo "$GITHUB_REPOSITORY"
publish-to-testpypi: publish-to-testpypi:
name: Publish Python 🐍 distribution 📦 to TestPyPI name: Publish Python distribution to TestPyPI
needs: needs:
- build - build
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: environment:
@ -105,15 +107,15 @@ jobs:
url: https://test.pypi.org/p/highlight-video-maker url: https://test.pypi.org/p/highlight-video-maker
permissions: permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing id-token: write # IMPORTANT: mandatory for trusted publishing
steps: steps:
- name: Download all the dists - name: Download all the dists
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
with: with:
name: python-package-distributions name: python-package-distributions
path: dist/ path: dist/
- name: Publish distribution 📦 to TestPyPI - name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1 uses: pypa/gh-action-pypi-publish@release/v1
with: with:
repository-url: https://test.pypi.org/legacy/ repository-url: https://test.pypi.org/legacy/