Skip to content

ci(github-actions): resolve issue of publishing multiple times to pypi #5

ci(github-actions): resolve issue of publishing multiple times to pypi

ci(github-actions): resolve issue of publishing multiple times to pypi #5

Workflow file for this run

name: Build and Publish Package to Pypi

Check failure on line 1 in .github/workflows/publish.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/publish.yaml

Invalid workflow file

(Line: 22, Col: 11): 'python-version' is already defined, (Line: 23, Col: 11): 'python-version' is already defined, (Line: 26, Col: 11): 'python-version' is already defined
on:
push:
tags:
- "*"
jobs:
tests:
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4.1.6
- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: "uv.lock"
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --all-groups
- name: Run tests
run: uv run pytest
publish:
needs: tests
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.6
- name: Setup uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
cache-dependency-glob: "uv.lock"
python-version: "3.12"
- name: Install dependencies
run: uv sync --all-groups
- name: Build and publish
env:
UV_PUBLISH_USERNAME: __token__
UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
uv build
uv publish