Skip to content

Commit e853bb1

Browse files
authored
Set up trusted publishing from GHA (#193)
* Set up trusted publishing from GHA - Add build to dev deps - Add sdist job to build sdist - Add publish job to publish tagged releases * Move UV env to workflow level
1 parent 651ef06 commit e853bb1

File tree

4 files changed

+79
-40
lines changed

4 files changed

+79
-40
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
tags:
7+
- v*
8+
pull_request:
9+
10+
permissions:
11+
contents: read
12+
13+
env:
14+
UV_SYSTEM_PYTHON: 1
15+
16+
jobs:
17+
test:
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]
23+
os: [macOS-latest, ubuntu-latest, windows-latest]
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
- name: Set Up Python ${{ matrix.python-version }}
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
allow-prereleases: true
33+
- uses: hynek/setup-cached-uv@v2
34+
with:
35+
cache-dependency-path: pyproject.toml
36+
- name: Install
37+
run: make EXTRAS=dev install
38+
- name: Test
39+
run: make test
40+
- name: Lint
41+
run: make lint
42+
43+
sdist:
44+
needs: test
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: actions/setup-python@v5
49+
with:
50+
python-version: '3.12'
51+
- uses: hynek/setup-cached-uv@v2
52+
with:
53+
cache-dependency-path: pyproject.toml
54+
- name: Install
55+
run: make install
56+
- name: Build
57+
run: python -m build --sdist
58+
- name: Upload
59+
uses: actions/upload-artifact@v3
60+
with:
61+
name: sdist
62+
path: dist
63+
64+
publish:
65+
needs: sdist
66+
runs-on: ubuntu-latest
67+
if: startsWith(github.ref, 'refs/tags/v')
68+
permissions:
69+
id-token: write
70+
steps:
71+
- uses: actions/download-artifact@v3
72+
with:
73+
name: sdist
74+
path: dist
75+
- uses: pypa/gh-action-pypi-publish@release/v1

makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
PKG:=aioitertools
22
EXTRAS:=dev,docs
33

4-
UV_VERSION:=$(shell uv --version)
5-
ifdef UV_VERSION
4+
UV:=$(shell uv --version)
5+
ifdef UV
66
VENV:=uv venv
77
PIP:=uv pip
88
else

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dependencies = ["typing_extensions>=4.0; python_version < '3.10'"]
2222
dev = [
2323
"attribution==1.8.0",
2424
"black==24.8.0",
25+
"build>=1.2",
2526
"coverage==7.6.1",
2627
"flake8==7.1.1",
2728
"flit==3.9.0",
@@ -60,4 +61,4 @@ skip_covered = true
6061

6162
[tool.mypy]
6263
# strict = true
63-
ignore_missing_imports = true
64+
ignore_missing_imports = true

0 commit comments

Comments
 (0)