Skip to content

Commit 23b942e

Browse files
committed
chore: Improved release.yml workflow
1 parent d4df6c9 commit 23b942e

File tree

1 file changed

+56
-27
lines changed

1 file changed

+56
-27
lines changed

.github/workflows/release.yml

Lines changed: 56 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,65 @@ on:
44
name: release
55

66
jobs:
7-
pypi-publish:
8-
name: upload release to PyPI
7+
release-build:
8+
name: Build release artifacts
99
runs-on: ubuntu-latest
10-
strategy:
11-
fail-fast: false
12-
matrix:
13-
python-version: ["3.13"]
1410

15-
# Specifying a GitHub environment is optional, but strongly encouraged
11+
permissions:
12+
id-token: write
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- run: git fetch origin develop
17+
18+
- name: Setup Python
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: 3.13
22+
23+
- name: Setup Graphviz
24+
uses: ts-graphviz/setup-graphviz@v1
25+
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v3
28+
with:
29+
enable-cache: true
30+
31+
- name: Install the project
32+
run: uv sync --all-extras --dev
33+
34+
- name: Test
35+
run: |
36+
uv run pytest
37+
38+
- name: Build
39+
run: |
40+
uv build
41+
42+
- name: Upload dists
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: release-dists
46+
path: dist/
47+
48+
49+
pypi-publish:
50+
# by a dedicated job to publish we avoid the risk of
51+
# running code with access to PyPI credentials
52+
name: Upload release to PyPI
53+
runs-on: ubuntu-latest
54+
needs:
55+
- release-build
1656
environment: release
1757
permissions:
18-
# IMPORTANT: this permission is mandatory for trusted publishing
1958
id-token: write
59+
2060
steps:
21-
- uses: actions/checkout@v3
22-
- run: git fetch origin develop
23-
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v4
25-
with:
26-
python-version: ${{ matrix.python-version }}
27-
- name: Setup Graphviz
28-
uses: ts-graphviz/setup-graphviz@v1
29-
- name: Install uv
30-
uses: astral-sh/setup-uv@v3
31-
with:
32-
enable-cache: true
33-
- name: Install the project
34-
run: uv sync --all-extras --dev
35-
- name: Build
36-
run: |
37-
uv build
38-
- name: Publish package distributions to PyPI
39-
uses: pypa/gh-action-pypi-publish@release/v1
61+
- name: Retrieve release distributions
62+
uses: actions/download-artifact@v4
63+
with:
64+
name: release-dists
65+
path: dist/
66+
67+
- name: Publish package distributions to PyPI
68+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)