microsoft/TypeAgent
Publicmirrored fromhttps://github.com/microsoft/TypeAgentAvailable
.github/workflows/release-py.yml
65lines · modecode
| 1 | # Copyright (c) Microsoft Corporation. |
| 2 | # Licensed under the MIT License. |
| 3 | |
| 4 | name: Release (PyPI via Trusted Publishing + uv) |
| 5 | |
| 6 | on: |
| 7 | push: |
| 8 | tags: [ "v*" ] # tag to publish |
| 9 | workflow_dispatch: # manual run |
| 10 | |
| 11 | permissions: |
| 12 | contents: read |
| 13 | |
| 14 | jobs: |
| 15 | build: |
| 16 | runs-on: ubuntu-latest |
| 17 | defaults: |
| 18 | run: |
| 19 | shell: bash |
| 20 | working-directory: python/ta # your project subdir |
| 21 | steps: |
| 22 | - uses: actions/checkout@v4 |
| 23 | |
| 24 | - name: Set up Python |
| 25 | uses: actions/setup-python@v5 |
| 26 | with: |
| 27 | python-version: "3.12" |
| 28 | |
| 29 | - name: Install uv |
| 30 | run: | |
| 31 | curl -LsSf https://astral.sh/uv/install.sh | sh |
| 32 | echo "$HOME/.local/bin" >> "$GITHUB_PATH" |
| 33 | |
| 34 | - name: Create .venv and install deps |
| 35 | run: uv sync |
| 36 | |
| 37 | - name: Build sdist + wheel (via make) |
| 38 | run: make build # runs `uv build`, outputs to dist/ |
| 39 | |
| 40 | - name: Upload build artifacts |
| 41 | uses: actions/upload-artifact@v4 |
| 42 | with: |
| 43 | name: dist |
| 44 | path: python/ta/dist/ |
| 45 | |
| 46 | publish: |
| 47 | needs: build |
| 48 | runs-on: ubuntu-latest |
| 49 | environment: |
| 50 | name: pypi |
| 51 | url: https://pypi.org/p/typeagent-py |
| 52 | permissions: |
| 53 | id-token: write # REQUIRED for Trusted Publishing (no tokens!) |
| 54 | contents: read |
| 55 | steps: |
| 56 | - uses: actions/download-artifact@v4 |
| 57 | with: |
| 58 | name: dist |
| 59 | path: dist |
| 60 | |
| 61 | - name: Publish to PyPI |
| 62 | uses: pypa/gh-action-pypi-publish@release/v1 |
| 63 | # For TestPyPI first, add: |
| 64 | # with: |
| 65 | # repository-url: https://test.pypi.org/legacy/ |
| 66 | |