Add id-token
permission for publish job
#26
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI Pipeline | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: read | |
pull-requests: write | |
id-token: write | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv with Caching | |
uses: astral-sh/setup-uv@v4 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "pyproject.toml" | |
- name: Install Dependencies | |
run: | | |
uv sync --dev | |
- name: Run Ruff | |
run: uv run ruff check --output-format=github . | |
test: | |
name: Run Tests | |
runs-on: ubuntu-latest | |
needs: lint | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install uv with Caching | |
uses: astral-sh/setup-uv@v4 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "pyproject.toml" | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Dependencies | |
run: | | |
uv sync --dev | |
- name: Run Tests with Coverage | |
run: | | |
uv run pytest | |
- name: Minimize uv Cache | |
run: uv cache prune --ci | |
publish: | |
name: Build and Publish to PyPI | |
runs-on: ubuntu-latest | |
needs: test | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install git | |
run: sudo apt-get install git | |
- name: Install uv with Caching | |
uses: astral-sh/setup-uv@v4 | |
with: | |
enable-cache: true | |
cache-dependency-glob: "pyproject.toml" | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Bump Version, Build, Publish | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub CI" | |
uvx --from rust-just just publish-package | |
- name: Minimize uv Cache | |
run: uv cache prune --ci |