File tree Expand file tree Collapse file tree 1 file changed +47
-3
lines changed
Expand file tree Collapse file tree 1 file changed +47
-3
lines changed Original file line number Diff line number Diff line change 44 release :
55 types : [published]
66 workflow_dispatch :
7+ inputs :
8+ confirm :
9+ description : ' Type "publish" to confirm PyPI upload'
10+ required : true
11+ default : ' no'
712
813jobs :
14+ test :
15+ name : Run Tests Before Publishing
16+ runs-on : ubuntu-latest
17+ steps :
18+ - name : Checkout code
19+ uses : actions/checkout@v4
20+
21+ - name : Install uv
22+ uses : astral-sh/setup-uv@v3
23+
24+ - name : Set up Python
25+ uses : actions/setup-python@v5
26+ with :
27+ python-version : ' 3.12'
28+
29+ - name : Install dependencies
30+ run : uv pip install --system -e ".[dev]"
31+
32+ - name : Run ruff
33+ run : ruff check .
34+
35+ - name : Run mypy
36+ run : mypy contractions/ tests/
37+
38+ - name : Run tests with coverage
39+ run : pytest tests/ --cov=contractions --cov-report=term
40+
941 deploy :
42+ name : Build and Publish to PyPI
1043 runs-on : ubuntu-latest
44+ needs : test
45+ if : github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master' || github.event_name == 'release'
1146 permissions :
1247 id-token : write
1348
@@ -17,15 +52,24 @@ jobs:
1752 with :
1853 fetch-depth : 0
1954
55+ - name : Check manual confirmation
56+ if : github.event_name == 'workflow_dispatch'
57+ run : |
58+ if [ "${{ github.event.inputs.confirm }}" != "publish" ]; then
59+ echo "❌ Manual confirmation required. Type 'publish' to proceed."
60+ exit 1
61+ fi
62+
63+ - name : Install uv
64+ uses : astral-sh/setup-uv@v3
65+
2066 - name : Set up Python
2167 uses : actions/setup-python@v5
2268 with :
2369 python-version : ' 3.12'
2470
2571 - name : Install build dependencies
26- run : |
27- python -m pip install --upgrade pip
28- pip install build twine
72+ run : uv pip install --system build twine
2973
3074 - name : Update version from git commits
3175 run : |
You can’t perform that action at this time.
0 commit comments