Skip to content

Commit be419f3

Browse files
committed
Improve Check Release Isolation
1 parent 6598291 commit be419f3

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

.github/actions/check-release/action.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,14 @@ runs:
3333
fi
3434
3535
# Install Jupyter Releaser from git unless we are testing Releaser itself
36-
export repo_name=$(echo ${GITHUB_REPOSITORY} | cut -d'/' -f 2)
37-
echo "repo name: ${repo_name}"
38-
if [ ${repo_name} != "jupyter_releaser" ]; then
36+
export RH_REPO_NAME=$(echo ${GITHUB_REPOSITORY} | cut -d'/' -f 2)
37+
echo "repo name: ${RH_REPO_NAME}"
38+
if [ ${RH_REPO_NAME} != "jupyter_releaser" ]; then
3939
pip install git+https://github.com/jupyter-server/jupyter_releaser.git
4040
fi
4141
42+
export RH_IS_CHECK_RELEASE=true
43+
4244
# Draft Changelog
4345
python -m jupyter_releaser.actions.draft_changelog
4446

jupyter_releaser/actions/draft_release.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,38 @@
11
# Copyright (c) Jupyter Development Team.
22
# Distributed under the terms of the Modified BSD License.
3+
import os
4+
import shutil
5+
from pathlib import Path
6+
7+
from jupyter_releaser.util import CHECKOUT_NAME
8+
from jupyter_releaser.util import log
39
from jupyter_releaser.util import run
410

11+
check_release = os.environ.get("RH_IS_CHECK_RELEASE").lower() == "true"
12+
13+
if check_release:
14+
log("Handling Check Release action")
15+
16+
# Extract the changelog
17+
changelog_location = os.environ.get("RH_CHANGELOG", "CHANGELOG.md")
18+
changelog_location = Path(CHECKOUT_NAME) / changelog_location
19+
changelog_text = changelog_location.read_text(encoding="utf-8")
20+
21+
# Remove the checkout
22+
shutil.rmtree(CHECKOUT_NAME)
23+
24+
# Re-install the parent dir in case it was overshadowed
25+
run("pip install -e .")
26+
527
run("jupyter-releaser prep-git")
628
run("jupyter-releaser bump-version")
29+
30+
if check_release:
31+
# Override the changelog
32+
log("Patching the changelog")
33+
log(changelog_text)
34+
Path(changelog_location).write_text(changelog_text)
35+
736
run("jupyter-releaser check-changelog")
837
run("jupyter-releaser check-links")
938
# Make sure npm comes before python in case it produces

0 commit comments

Comments
 (0)