Skip to content

Commit 9541117

Browse files
committed
debug
1 parent 63e7553 commit 9541117

File tree

3 files changed

+82
-167
lines changed

3 files changed

+82
-167
lines changed

.github/workflows/create_release_artifacts.yaml renamed to .github/workflows/create_draft_release.yaml

Lines changed: 70 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Create Release Artifacts
1+
name: Create Draft Release
22

33
on:
44
workflow_call:
@@ -8,15 +8,9 @@ on:
88
required: true
99
type: string
1010
outputs:
11-
sdist:
12-
description: The source distribution filename
13-
value: ${{ jobs.package_python3.outputs.sdist }}
14-
py3_wheel:
15-
description: The Python 3 wheel filename
16-
value: ${{ jobs.package_python3.outputs.wheel }}
17-
py2_wheel:
18-
description: The Python 2 wheel filename
19-
value: ${{ jobs.package_python2.outputs.wheel }}
11+
release_id:
12+
description: The created release ID
13+
value: ${{ jobs.create_release.outputs.release_id }}
2014

2115
permissions:
2216
contents: none
@@ -249,3 +243,69 @@ jobs:
249243
fi
250244
251245
stubtest python_minifier --allowlist typing_test/stubtest-allowlist.txt
246+
247+
create_release:
248+
name: Create Draft Release
249+
runs-on: ubuntu-24.04
250+
needs:
251+
- package_python2
252+
- package_python3
253+
- documentation
254+
permissions:
255+
contents: write
256+
outputs:
257+
release_id: ${{ steps.create_release.outputs.release_id }}
258+
steps:
259+
- name: Checkout
260+
uses: actions/[email protected]
261+
with:
262+
fetch-depth: 1
263+
show-progress: false
264+
persist-credentials: false
265+
266+
- name: Generate Release Notes
267+
run: |
268+
cp .github/release_preamble.md release_body.md
269+
270+
# Extract the topmost changelog section (first version found)
271+
changelog_section=$(awk '/^## \[.*\]/{if(!found){found=1; next}} /^## \[.*\]/{if(found) exit} found' CHANGELOG.md)
272+
if [ -z "$changelog_section" ]; then
273+
echo "No changelog section found, using only release preamble"
274+
else
275+
echo "$changelog_section" >> release_body.md
276+
fi
277+
278+
- name: Create Draft Release
279+
id: create_release
280+
env:
281+
VERSION: ${{ inputs.release_version }}
282+
GH_TOKEN: ${{ github.token }}
283+
run: |
284+
set -e
285+
release_url=$(gh release create "$VERSION" \
286+
--draft \
287+
--title "$VERSION" \
288+
--notes-file release_body.md)
289+
echo "Draft release created: $release_url"
290+
291+
# Extract the untagged release ID from the URL
292+
untagged_id=$(echo "$release_url" | sed 's|.*tag/||')
293+
echo "release_id=$untagged_id" >> "$GITHUB_OUTPUT"
294+
295+
- name: Download distribution artifacts
296+
uses: actions/[email protected]
297+
with:
298+
pattern: dist-*
299+
path: dist/
300+
merge-multiple: true
301+
302+
- name: Upload Release Assets
303+
env:
304+
RELEASE_ID: ${{ steps.create_release.outputs.release_id }}
305+
GH_TOKEN: ${{ github.token }}
306+
run: |
307+
gh release upload "$RELEASE_ID" \
308+
--repo ${{ github.repository }} \
309+
dist/${{ needs.package_python3.outputs.sdist }} \
310+
dist/${{ needs.package_python3.outputs.wheel }} \
311+
dist/${{ needs.package_python2.outputs.wheel }}

.github/workflows/release.yaml

Lines changed: 8 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -17,90 +17,19 @@ permissions:
1717

1818
jobs:
1919

20-
create_artifacts:
21-
name: Create Artifacts
22-
uses: ./.github/workflows/create_release_artifacts.yaml
23-
with:
24-
release_version: ${{ inputs.version }}
25-
26-
create_release:
20+
create_draft_release:
2721
name: Create Draft Release
28-
runs-on: ubuntu-24.04
22+
uses: ./.github/workflows/create_draft_release.yaml
2923
if: github.ref == 'refs/heads/main'
30-
needs:
31-
- create_artifacts
3224
permissions:
3325
contents: write
34-
outputs:
35-
release_id: ${{ steps.create_release.outputs.release_id }}
36-
steps:
37-
- name: Checkout
38-
uses: actions/[email protected]
39-
with:
40-
fetch-depth: 1
41-
show-progress: false
42-
persist-credentials: false
43-
44-
- name: Generate Release Notes
45-
env:
46-
VERSION: ${{ inputs.version }}
47-
run: |
48-
cp .github/release_preamble.md release_body.md
49-
changelog_section=$(awk '/^## \['"$VERSION"'\]/{flag=1; next} /^## \[/{flag=0} flag' CHANGELOG.md)
50-
if [ -z "$changelog_section" ]; then
51-
echo "Error: No changelog section found for version $VERSION"
52-
exit 1
53-
fi
54-
echo "$changelog_section" >> release_body.md
55-
56-
- name: Create Draft Release
57-
id: create_release
58-
env:
59-
VERSION: ${{ inputs.version }}
60-
GH_TOKEN: ${{ github.token }}
61-
run: |
62-
set -e
63-
release_url=$(gh release create "$VERSION" \
64-
--draft \
65-
--title "$VERSION" \
66-
--notes-file release_body.md)
67-
echo "Draft release created: $release_url"
68-
69-
# Extract the untagged release ID from the URL
70-
untagged_id=$(echo "$release_url" | sed 's|.*tag/||')
71-
echo "release_id=$untagged_id" >> "$GITHUB_OUTPUT"
72-
73-
upload_artifacts:
74-
name: Upload Artifacts to Release
75-
needs:
76-
- create_release
77-
- create_artifacts
78-
runs-on: ubuntu-24.04
79-
permissions:
80-
contents: write
81-
steps:
82-
- name: Download distribution artifacts
83-
uses: actions/[email protected]
84-
with:
85-
pattern: dist-*
86-
path: dist/
87-
merge-multiple: true
88-
89-
- name: Upload Release Assets
90-
env:
91-
RELEASE_ID: ${{ needs.create_release.outputs.release_id }}
92-
GH_TOKEN: ${{ github.token }}
93-
run: |
94-
gh release upload "$RELEASE_ID" \
95-
--repo ${{ github.repository }} \
96-
dist/${{ needs.create_artifacts.outputs.sdist }} \
97-
dist/${{ needs.create_artifacts.outputs.py3_wheel }} \
98-
dist/${{ needs.create_artifacts.outputs.py2_wheel }}
26+
with:
27+
release_version: ${{ inputs.version }}
9928

10029
publish_to_pypi:
10130
name: Publish to PyPI
10231
needs:
103-
- upload_artifacts
32+
- create_draft_release
10433
runs-on: ubuntu-24.04
10534
permissions:
10635
id-token: write
@@ -124,7 +53,7 @@ jobs:
12453
publish_docs:
12554
name: Publish Documentation
12655
needs:
127-
- upload_artifacts
56+
- create_draft_release
12857
runs-on: ubuntu-24.04
12958
permissions:
13059
pages: write
@@ -140,7 +69,7 @@ jobs:
14069
publish_release:
14170
name: Publish Release
14271
needs:
143-
- create_release
72+
- create_draft_release
14473
- publish_to_pypi
14574
- publish_docs
14675
runs-on: ubuntu-24.04
@@ -149,7 +78,7 @@ jobs:
14978
steps:
15079
- name: Publish Release
15180
env:
152-
RELEASE_ID: ${{ needs.create_release.outputs.release_id }}
81+
RELEASE_ID: ${{ needs.create_draft_release.outputs.release_id }}
15382
GH_TOKEN: ${{ github.token }}
15483
run: |
15584
gh release edit "$RELEASE_ID" \

.github/workflows/release_test.yaml

Lines changed: 4 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -32,86 +32,12 @@ jobs:
3232
echo "Version: $VERSION"
3333
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
3434
35-
create_artifacts:
36-
name: Create Artifacts
37-
uses: ./.github/workflows/create_release_artifacts.yaml
35+
create_draft_release:
36+
name: Create Draft Release
37+
uses: ./.github/workflows/create_draft_release.yaml
3838
needs:
3939
- determine_version
4040
permissions:
41-
contents: read
41+
contents: write
4242
with:
4343
release_version: ${{ needs.determine_version.outputs.release_version }}
44-
45-
create_release:
46-
name: Create Draft Release
47-
runs-on: ubuntu-24.04
48-
needs:
49-
- create_artifacts
50-
- determine_version
51-
permissions:
52-
contents: write
53-
outputs:
54-
release_id: ${{ steps.create_release.outputs.release_id }}
55-
steps:
56-
- name: Checkout
57-
uses: actions/[email protected]
58-
with:
59-
fetch-depth: 1
60-
show-progress: false
61-
persist-credentials: false
62-
63-
- name: Generate Release Notes
64-
env:
65-
VERSION: "Unreleased"
66-
run: |
67-
cp .github/release_preamble.md release_body.md
68-
changelog_section=$(awk '/^## \['"$VERSION"'\]/{flag=1; next} /^## \[/{flag=0} flag' CHANGELOG.md)
69-
if [ -z "$changelog_section" ]; then
70-
echo "No changelog section found for version $VERSION, using only release preamble"
71-
else
72-
echo "$changelog_section" >> release_body.md
73-
fi
74-
75-
- name: Create Draft Release
76-
id: create_release
77-
env:
78-
VERSION: ${{ needs.determine_version.outputs.release_version }}
79-
GH_TOKEN: ${{ github.token }}
80-
run: |
81-
set -e
82-
release_url=$(gh release create "$VERSION" \
83-
--draft \
84-
--title "$VERSION" \
85-
--notes-file release_body.md)
86-
echo "Draft release created: $release_url"
87-
88-
# Extract the untagged release ID from the URL
89-
untagged_id=$(echo "$release_url" | sed 's|.*tag/||')
90-
echo "release_id=$untagged_id" >> "$GITHUB_OUTPUT"
91-
92-
upload_artifacts:
93-
name: Upload Artifacts to Release
94-
needs:
95-
- create_release
96-
- create_artifacts
97-
runs-on: ubuntu-24.04
98-
permissions:
99-
contents: write
100-
steps:
101-
- name: Download distribution artifacts
102-
uses: actions/[email protected]
103-
with:
104-
pattern: dist-*
105-
path: dist/
106-
merge-multiple: true
107-
108-
- name: Upload Release Assets
109-
env:
110-
RELEASE_ID: ${{ needs.create_release.outputs.release_id }}
111-
GH_TOKEN: ${{ github.token }}
112-
run: |
113-
gh release upload "$RELEASE_ID" \
114-
--repo ${{ github.repository }} \
115-
dist/${{ needs.create_artifacts.outputs.sdist }} \
116-
dist/${{ needs.create_artifacts.outputs.py3_wheel }} \
117-
dist/${{ needs.create_artifacts.outputs.py2_wheel }}

0 commit comments

Comments
 (0)