Repository navigation
96 lines (87 loc) · 3.56 KB
/
Copy pathpublish_release.yml
File metadata and controls
96 lines (87 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Publish a release on the site
# Takes a released tag, reads that release's hashes_*.md from
# winpython/winpython, and opens a pull request adding the release to
# md5_sha1.txt and releases.html.
#
# Dispatched by hand, for finals. Betas do not go on the site: the archive has
# never listed one in 32 entries, and only a single cycle ever put one in
# md5_sha1.txt. Their checksums stay available as assets on their own release.
#
# The sentences a build cannot know -- the highlights line, the release notes
# URL, which interpreter each minor ships -- come from
# .github/scripts/site_content.toml, which is edited before dispatching.
on:
workflow_dispatch:
inputs:
tag:
description: 'Release tag in winpython/winpython, e.g. 2026-04'
required: true
type: string
date:
description: 'Publication date as YYYY-MM-DD; blank uses site_content.toml, then today'
required: false
default: ''
type: string
permissions: {}
jobs:
render:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout the site
# credentials are kept: this job pushes a branch
uses: actions/checkout@v6
- name: Install Python
uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Install pinned test dependencies
run: python -m pip install --no-deps --require-hashes -r tests/requirements.txt
- name: Test the generator before letting it write
run: python -m pytest -q
- name: Download the release's hashes
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ inputs.tag }}
run: |
mkdir -p release_hashes
gh release download "$TAG" --repo winpython/winpython \
--dir release_hashes --pattern 'hashes_*.md'
ls -1 release_hashes
- name: Render the release into the site
env:
TAG: ${{ inputs.tag }}
WHEN: ${{ inputs.date }}
run: |
python .github/scripts/render_site.py \
--tag "$TAG" --hashes release_hashes --site . \
${WHEN:+--date "$WHEN"}
rm -rf release_hashes
- name: Open the pull request
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
TAG: ${{ inputs.tag }}
BASE: ${{ github.event.repository.default_branch }}
run: |
branch="release/$TAG"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git switch -c "$branch"
git add md5_sha1.txt releases.html
if git diff --cached --quiet; then
echo "the site already carries $TAG; nothing to open"
exit 0
fi
git commit -m "Publish WinPython $TAG on the site"
# the branch is generated wholly by this job, so a re-run replaces it
git push --force origin "$branch"
if gh pr view "$branch" --json number >/dev/null 2>&1; then
echo "pull request for $branch is open; the push updated it"
else
gh pr create --base "$BASE" --head "$branch" \
--title "Publish WinPython $TAG on the site" \
--body "Adds \`$TAG\` to \`md5_sha1.txt\` and the \`releases.html\` archive, rendered from the \`hashes_*.md\` of that release. The prose came from \`site_content.toml\`. Check the highlights line and the interpreter versions before merging; everything else is derived."
fi