Skip to content

Commit d77acfd

Browse files
fcollonvalpre-commit-ci[bot]blink1073
authored
Add silent option (#526)
* Add silent option * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add action and workflow to remove changelog silent entry * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Make the CI happier * Add unit test for remove placeholder * Fix typing * TO REMOVE point to the current branch * Fix logic to silent the entry in the changelog only when releasing * Don't get the changelog for silent GH release in populate release * Debug populate-release * Don't request metadata uselessly * Ignore release missing known tagged released * Fix removing placeholder in changelong * Remove debug log * Revert "TO REMOVE point to the current branch" This reverts commit 7531de1. * Add documentation * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Don't print the changelog in the job log if the release is silent * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Fix mypy errors * Add ruff exception * [skip ci] Comment new flag silent * [skip ci] Comment new flag in example * Fix doc --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Steven Silvester <[email protected]>
1 parent cb677f5 commit d77acfd

File tree

22 files changed

+545
-44
lines changed

22 files changed

+545
-44
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ inputs:
2121
description: "If set, do not make a PR"
2222
default: "false"
2323
required: false
24+
silent:
25+
description: "Set a placeholder in the changelog and don't publish the release."
26+
required: false
27+
type: boolean
2428
since:
2529
description: "Use PRs with activity since this date or git reference"
2630
required: false
@@ -55,6 +59,7 @@ runs:
5559
export RH_VERSION_SPEC=${{ inputs.version_spec }}
5660
export RH_POST_VERSION_SPEC=${{ inputs.post_version_spec }}
5761
export RH_DRY_RUN=${{ inputs.dry_run }}
62+
export RH_SILENT=${{ inputs.silent }}
5863
export RH_SINCE=${{ inputs.since }}
5964
export RH_SINCE_LAST_STABLE=${{ inputs.since_last_stable }}
6065
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: "Publish Changelog"
2+
description: "Remove silent placeholder entries in the changelog file."
3+
inputs:
4+
token:
5+
description: "GitHub access token"
6+
required: true
7+
target:
8+
description: "The owner/repo GitHub target"
9+
required: true
10+
branch:
11+
description: "The branch to target"
12+
required: false
13+
dry_run:
14+
description: "If set, do not make a PR"
15+
default: "false"
16+
required: false
17+
outputs:
18+
pr_url:
19+
description: "The html URL of the draft GitHub release"
20+
value: ${{ steps.publish-changelog.outputs.pr_url }}
21+
runs:
22+
using: "composite"
23+
steps:
24+
- name: install-releaser
25+
shell: bash -eux {0}
26+
run: |
27+
# Install Jupyter Releaser from git unless we are testing Releaser itself
28+
if ! command -v jupyter-releaser &> /dev/null
29+
then
30+
pip install -q git+https://github.com/jupyter-server/jupyter_releaser.git@v2
31+
fi
32+
33+
- id: publish-changelog
34+
shell: bash -eux {0}
35+
run: |
36+
export GITHUB_ACCESS_TOKEN=${{ inputs.token }}
37+
export GITHUB_ACTOR=${{ github.triggering_actor }}
38+
export RH_REPOSITORY=${{ inputs.target }}
39+
if [ ! -z ${{ inputs.branch }} ]; then
40+
export RH_BRANCH=${{ inputs.branch }}
41+
fi
42+
export RH_DRY_RUN=${{ inputs.dry_run }}
43+
44+
python -m jupyter_releaser.actions.publish_changelog
45+
46+
- shell: bash -eux {0}
47+
run: |
48+
echo "## Next Step" >> $GITHUB_STEP_SUMMARY
49+
echo "Merge the changelog update PR: ${{ steps.publish-changelog.outputs.pr_url }}" >> $GITHUB_STEP_SUMMARY

.github/workflows/prep-release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
post_version_spec:
1616
description: "Post Version Specifier"
1717
required: false
18+
silent:
19+
description: "Set a placeholder in the changelog and don't publish the release."
20+
required: false
21+
type: boolean
1822
since:
1923
description: "Use PRs with activity since this date or git reference"
2024
required: false
@@ -41,6 +45,7 @@ jobs:
4145
post_version_spec: ${{ github.event.inputs.post_version_spec }}
4246
target: ${{ github.event.inputs.target }}
4347
branch: ${{ github.event.inputs.branch }}
48+
silent: ${{ github.event.inputs.silent }}
4449
since: ${{ github.event.inputs.since }}
4550
since_last_stable: ${{ github.event.inputs.since_last_stable }}
4651

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Publish Changelog"
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
token:
6+
description: "GitHub access token"
7+
required: true
8+
target:
9+
description: "The owner/repo GitHub target"
10+
required: true
11+
branch:
12+
description: "The branch to target"
13+
required: false
14+
15+
jobs:
16+
publish_changelog:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
21+
- name: Install Dependencies
22+
shell: bash
23+
run: |
24+
pip install -e .
25+
- name: Publish changelog
26+
id: publish-changelog
27+
uses: jupyter-server/jupyter_releaser/.github/actions/publish-changelog@v2
28+
with:
29+
token: ${{ secrets.ADMIN_GITHUB_TOKEN }}
30+
target: ${{ github.event.inputs.target }}
31+
branch: ${{ github.event.inputs.branch }}
32+
33+
- name: "** Next Step **"
34+
run: |
35+
echo "Merge the changelog update PR: ${{ steps.publish-changelog.outputs.pr_url }}"

docs/source/get_started/making_release_from_releaser.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,22 @@ already uses Jupyter Releaser.
7070
to the next minor version directly. Note: The "next" and "patch" options
7171
are not available when using dev versions, you must use explicit versions
7272
instead.
73+
7374
- Use the "since" field to select PRs prior to the latest tag to include in the release
74-
- Type "true" in the "since the last stable git tag" if you would like to include PRs since the last non-prerelease version tagged on the target repository and branch.
75+
76+
- Check "Use PRs with activity since the last stable git tag" if you would like to include PRs since the last non-prerelease version tagged on the target repository and branch.
77+
78+
- Check "Set a placeholder in the changelog and don't publish the release" if
79+
you want to carry a silent release (e.g. in case of a security release).
80+
That option will change the default behavior by keeping the version
81+
changelog only in the GitHub release and keeping it private (aka in _Draft_
82+
state). The changelog file will only contains a placeholder to be replaced
83+
by the release body once the maintainers have chosen to publish the release.
84+
7585
- The additional "Post Version Spec" field should be used if your repo uses a dev version (e.g. 0.7.0.dev0)
86+
7687
- The workflow will use the GitHub API to find the relevant pull requests and make an appropriate changelog entry.
88+
7789
- The workflow will create a draft GitHub release to the target
7890
repository and branch, with the draft changelog contents.
7991

docs/source/get_started/making_release_from_repo.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,17 @@ already uses Jupyter Releaser using workflows on its own repository.
3030

3131
- Use the "since" field to select PRs prior to the latest tag to include in the release
3232

33-
- Type "true" in the "since the last stable git tag" if you would like to include PRs since the last non-prerelease version tagged on the target repository and branch.
33+
- Check "Use PRs with activity since the last stable git tag" if you would like to include PRs since the last non-prerelease version tagged on the target repository and branch.
3434

3535
- The additional "Post Version Spec" field should be used if your repo uses a dev version (e.g. 0.7.0.dev0)
3636

37+
- Check "Set a placeholder in the changelog and don't publish the release" if
38+
you want to carry a silent release (e.g. in case of a security release).
39+
That option will change the default behavior by keeping the version
40+
changelog only in the GitHub release and keeping it private (aka in _Draft_
41+
state). The changelog file will only contains a placeholder to be replaced
42+
by the release body once the maintainers have chosen to publish the release.
43+
3744
- The workflow will use the GitHub API to find the relevant pull requests and make an appropriate changelog entry.
3845

3946
- The workflow will create a draft GitHub release to the target

docs/source/how_to_guides/convert_repo_from_releaser.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ B. Prep target repository:
6969
build system and for version handling.
7070
- If previously providing `version_info` like `version_info = (1, 7, 0, '.dev', '0')`, use a pattern like the one below in your version file:
7171

72-
```toml
72+
```python
7373
import re
7474
from typing import List
7575

docs/source/how_to_guides/convert_repo_from_repo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ See checklist below for details:
5858
build system and for version handling.
5959
- If previously providing `version_info` like `version_info = (1, 7, 0, '.dev', '0')`, use a pattern like the one below in your version file:
6060

61-
```toml
61+
```python
6262
import re
6363
from typing import List
6464

-58.8 KB
Loading
-198 KB
Loading

0 commit comments

Comments
 (0)