Skip to content

Commit 0951179

Browse files
committed
ci(release): improve performance release workflow
1 parent 4ad5323 commit 0951179

File tree

1 file changed

+34
-65
lines changed

1 file changed

+34
-65
lines changed
Lines changed: 34 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -5,67 +5,29 @@ on:
55
branches: [ main ]
66
push:
77
branches: [ main ]
8-
9-
# Publish only when a version tag is pushed
10-
tags:
11-
- '[0-9]*'
8+
# Authorize to publish manually from the Actions tab
9+
release:
10+
types: [published]
11+
workflow_dispatch:
1212

1313
permissions:
1414
contents: write # For creating the release
1515
id-token: write # Required for PyPI Trusted Publisher
1616
actions: read
1717

1818
jobs:
19-
test-and-lint:
20-
name: Test & Lint
21-
runs-on: ubuntu-latest
22-
strategy:
23-
fail-fast: false
24-
matrix:
25-
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
26-
steps:
27-
- name: Checkout
28-
uses: actions/checkout@v4
29-
30-
- name: Set up UV
31-
uses: astral-sh/setup-uv@v6
32-
with:
33-
python-version: ${{ matrix.python-version }}
34-
35-
- name: Cache UV
36-
uses: actions/cache@v4
37-
with:
38-
path: ~/.cache/uv
39-
key: ${{ runner.os }}-uv-${{ matrix.python-version }}-${{ hashFiles('uv.lock') }}
40-
restore-keys: |
41-
${{ runner.os }}-uv-${{ matrix.python-version }}-
42-
43-
- name: Sync dev dependencies
44-
run: uv sync --locked --all-extras --dev --no-progress -q
45-
46-
- name: Lint / Format / Type-check
47-
run: uv run lint
48-
49-
- name: Run tests
50-
run: uv run pytest
51-
52-
- name: Upload coverage to Codecov
53-
uses: codecov/codecov-action@v4
54-
with:
55-
files: ./coverage.xml
56-
slug: Athroniaeth/fastapi-api-key
57-
fail_ci_if_error: true
58-
env:
59-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
60-
19+
dev:
20+
uses: ./.github/workflows/development.yml
21+
secrets: inherit
6122

6223
publish:
24+
needs: dev
6325
name: Publish to PyPI & Create GitHub Release
6426
runs-on: ubuntu-latest
65-
needs: [ test-and-lint ]
6627

6728
# Runs only if on a version tag (e.g., refs/tags/1.2.3)
68-
if: startsWith(github.ref, 'refs/tags/')
29+
# Runs only when code is pushed to main (not on PRs)
30+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
6931
steps:
7032
- name: Checkout (full history for changelog/tools)
7133
uses: actions/checkout@v4
@@ -80,28 +42,14 @@ jobs:
8042
- name: Sync dev dependencies
8143
run: uv sync --locked --all-extras --dev --no-progress -q
8244

83-
- name: Lint / Format / Type-check
84-
run: |
85-
uv run lint
86-
uv run pytest
87-
88-
- name: Upload coverage to Codecov
89-
uses: codecov/codecov-action@v4
90-
with:
91-
files: ./coverage.xml
92-
slug: Athroniaeth/fastapi-api-key
93-
fail_ci_if_error: true
94-
env:
95-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
96-
9745
- name: Build sdist & wheel with uv
9846
run: uv build
9947

10048
# Publication via OIDC (Trusted Publisher) – no secret required on GitHub side
10149
- name: Publish to PyPI
102-
env:
103-
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
104-
run: uv publish --verbose
50+
# env:
51+
# PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
52+
run: uv publish --verbose --trusted-publisher
10553

10654
# GitHub Release with auto notes + attached artifacts (sdist/wheel)
10755
- name: Create GitHub Release
@@ -113,3 +61,24 @@ jobs:
11361
files: |
11462
dist/*.whl
11563
dist/*.tar.gz
64+
65+
docs:
66+
name: Deploy MkDocs
67+
runs-on: ubuntu-latest
68+
needs: publish
69+
# Runs only when code is pushed to main (when MR, not on PRs)
70+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
71+
steps:
72+
- name: Checkout
73+
uses: actions/checkout@v4
74+
75+
- name: Set up UV
76+
uses: astral-sh/setup-uv@v6
77+
with:
78+
python-version: '3.13'
79+
80+
- name: Install dependencies
81+
run: uv sync --locked --all-extras --dev --no-progress -q
82+
83+
- name: Deploy MkDocs
84+
run: uv run mkdocs gh-deploy --force

0 commit comments

Comments
 (0)