Skip to content

Add token to env

Add token to env #221

Workflow file for this run

name: CI
on:
push:
branches:
- "master"
tags:
- "*"
pull_request:
branches:
- "master"
workflow_dispatch:
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
run: uv python install
- name: Install the project
run: uv sync --all-extras --dev
- name: Ruff Format Check
run: uv run ruff format --check
- name: Ruff Check
run: uv run ruff check --diff
- name: Check twine
shell: bash
run: |
uv build
uv run twine check dist/*.tar.gz
test:
name: Test
needs: check
strategy:
matrix:
os: [ubuntu, macos, windows]
fail-fast: true
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
run: uv python install
- name: Install the project
run: uv sync --all-extras --dev
- name: Test
run: uv run pytest
publish:
name: Publish
runs-on: ubuntu-latest
needs: test
# Run only on pushing a tag starting with v
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Set up Python
run: uv python install
- name: Install the project
run: uv sync --all-extras --dev
- name: Build
run: uv build
- name: Publish to PyPI
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: |
uv publish --token $PYPI_TOKEN
# I suppose this is kinda useful to have, but, really, its just so that the mkdocs scraper
# can determine the latest version number in its github section.
- name: Github release
shell: bash
run: |
gh release create --generate-notes ${{ github.ref }} dist/*
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}