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

reusable workflow: uv -> pypi release #33

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
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
60 changes: 60 additions & 0 deletions .github/workflows/py-release-uv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Release

on:
workflow_call:
inputs:
environment:
description: "GitHub environment for the workflow"
type: string
default: "pypi"

permissions:
# for uploading artifacts to GitHub release
contents: write

# for trusted publishing and attest-build-provenance
id-token: write

# for attest-build-provenance
attestations: write

jobs:
release:
name: Release
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}

steps:
- name: 📥 Checkout Repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: 🏗️ Setup uv
uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4.2.0
- name: 🏗️ Install Python
run: uv python install

- name: 🔄 Sync Dependencies
run: uv sync --all-extras --dev
- name: 📦 Build Package
run: uv build

- name: 🚀 Publish to PyPI
uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3

- name: 🗑️ Clean signable artifacts
run: rm dist/*.publish.attestation

- name: 🔐 Generate Build Provenance
uses: actions/attest-build-provenance@7668571508540a607bdfd90a87a560489fe372eb # v2.1.0
with:
subject-path: "dist/*"

- name: 📥 Upload to GitHub
run: |
for file in dist/*; do
gh release upload "${GH_VERSION}" "$file"
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_VERSION: ${{ github.event.release.tag_name }}
Loading