Skip to content

Release (PyPI via Trusted Publishing + uv) #36

Release (PyPI via Trusted Publishing + uv)

Release (PyPI via Trusted Publishing + uv) #36

Workflow file for this run

# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
name: Release (PyPI via Trusted Publishing + uv)
on:
push:
tags: [ "v*" ] # tag to publish
workflow_dispatch: # manual run
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: . # your project subdir
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Create .venv and install deps
run: uv sync --extra dev
- name: Build sdist + wheel (via make)
run: make build # runs `uv build`, outputs to dist/
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
publish:
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/typeagent-py
permissions:
id-token: write # REQUIRED for Trusted Publishing (no tokens!)
contents: read
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# For TestPyPI first, add:
# with:
# repository-url: https://test.pypi.org/legacy/