mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-02 07:07:46 +00:00
REFACTOR: rewrite the release note scripts (#525)
* move "create release PR" script to `make_release/release-note/` * move "since last release" script to `make_release/release-note/` * add a script to list contributions for the release note * rewrite `since_last_release` to use `list-merged-prs` This commit also makes the script executable. * update the `make_release/` readme * add the commands to run to the release note template * rename `since_last_release.nu` to `get-full-changelog` * move the release note PR template to a standalone file * add another section to inspect Nushell PRs to write changelogs * fix the name of the command inside it's own doc
This commit is contained in:
parent
039930b4e4
commit
2e46f056c6
6 changed files with 170 additions and 96 deletions
|
@ -6,8 +6,30 @@ cd <your nushell repo>
|
|||
nu nu_deps.nu
|
||||
```
|
||||
|
||||
### Create the release note PR on the website
|
||||
## The release note
|
||||
> **Note**
|
||||
> the scripts have been written in such a way they can be run from anywhere
|
||||
|
||||
### Inspect the merged PRs to write changelogs
|
||||
```nu
|
||||
./make_release/release-note/list-merged-prs nushell/nushell
|
||||
```
|
||||
|
||||
### Complete the previous release note
|
||||
1. paste the output of
|
||||
```nu
|
||||
./make_release/release-note/get-full-changelog
|
||||
```
|
||||
to the "*Full changelog*" section.
|
||||
|
||||
2. paste the output of
|
||||
```nu
|
||||
./make_release/release-note/list-merged-prs nushell/nushell --label breaking-change --pretty --no-author
|
||||
```
|
||||
to the "*Breaking changes*" section.
|
||||
|
||||
### Create the release note PR on the website after the release
|
||||
see
|
||||
```nu
|
||||
./make_release/create-website-release-note-pr --help
|
||||
./make_release/release-note/create-pr --help
|
||||
```
|
||||
|
|
|
@ -34,7 +34,7 @@ def clean [repo: path] {
|
|||
#
|
||||
# # Example
|
||||
# [this PR](https://github.com/nushell/nushell.github.io/pull/916) has been created with the script
|
||||
# > ./make_release/create-website-release-note-pr 0.81 2023-06-06
|
||||
# > ./make_release/release-note/create-pr 0.81 2023-06-06
|
||||
def main [
|
||||
version: string # the version of the release, e.g. `0.80`
|
||||
date: datetime # the date of the upcoming release, e.g. `2023-05-16`
|
||||
|
@ -50,40 +50,6 @@ def main [
|
|||
let body = $"Please add your new features and breaking changes to the release notes
|
||||
by opening PRs against the `release-notes-($version)` branch."
|
||||
|
||||
let release_note_template = "---
|
||||
title: Nushell {{VERSION}}
|
||||
author: The Nu Authors
|
||||
author_site: https://twitter.com/nu_shell
|
||||
author_image: https://www.nushell.sh/blog/images/nu_logo.png
|
||||
excerpt: Today, we're releasing version {{VERSION}} of Nu. This release adds...
|
||||
---
|
||||
|
||||
# Nushell {{VERSION}}
|
||||
|
||||
Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your command line. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful command line pipelines.
|
||||
|
||||
Today, we're releasing version {{VERSION}} of Nu. This release adds...
|
||||
|
||||
<!-- more -->
|
||||
|
||||
# Where to get it
|
||||
|
||||
Nu {{VERSION}} is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/{{VERSION}}.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`.
|
||||
|
||||
NOTE: The optional dataframe functionality is available by `cargo install nu --features=dataframe`.
|
||||
|
||||
As part of this release, we also publish a set of optional plugins you can install and use with Nu. To install, use `cargo install nu_plugin_<plugin name>`.
|
||||
|
||||
# Themes of this release / New features
|
||||
|
||||
## New theme ([author](https://github.com/nushell/nushell/pulls))
|
||||
|
||||
# Breaking changes
|
||||
|
||||
- [#0000](https://github.com/nushell/nushell/pulls) we broke some stuff to improve nushell
|
||||
|
||||
# Full changelog"
|
||||
|
||||
log info "setting up nushell.github.io repo"
|
||||
git clone git@github.com:nushell/nushell.github.io $repo --origin nushell --branch main --single-branch
|
||||
|
||||
|
@ -91,7 +57,10 @@ As part of this release, we also publish a set of optional plugins you can insta
|
|||
git -C $repo checkout -b $branch nushell/main
|
||||
|
||||
log info "creating release note from template"
|
||||
$release_note_template
|
||||
$env.CURRENT_FILE
|
||||
| path dirname
|
||||
| path join "template.md"
|
||||
| open
|
||||
| str replace --all --string "{{VERSION}}" $version
|
||||
| save --force $blog_path
|
||||
|
25
make_release/release-note/get-full-changelog
Executable file
25
make_release/release-note/get-full-changelog
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/usr/bin/env nu
|
||||
|
||||
def main [] {
|
||||
let list_merged_prs_script = (
|
||||
$env.CURRENT_FILE | path dirname | path join "list-merged-prs"
|
||||
)
|
||||
|
||||
let changelogs = [
|
||||
[title repo];
|
||||
|
||||
[Nushell nushell/nushell]
|
||||
[Extension nushell/vscode-nushell-lang]
|
||||
[Documentation nushell/nushell.github.io]
|
||||
[Nu_Scripts nushell/nu_scripts]
|
||||
[Reedline reedline]
|
||||
]
|
||||
|
||||
$changelogs | each {|changelog|
|
||||
[
|
||||
$"## ($changelog.title)"
|
||||
(^$list_merged_prs_script $changelog.repo --pretty)
|
||||
] | str join "\n"
|
||||
}
|
||||
| str join "\n\n"
|
||||
}
|
71
make_release/release-note/list-merged-prs
Executable file
71
make_release/release-note/list-merged-prs
Executable file
|
@ -0,0 +1,71 @@
|
|||
#!/usr/bin/env nu
|
||||
|
||||
def md-link [
|
||||
text: string
|
||||
link: string
|
||||
] {
|
||||
$"[($text)]\(($link)\)"
|
||||
}
|
||||
|
||||
# list all merged PRs since last release
|
||||
def main [
|
||||
repo: string # the name of the repo, e.g. `nushell/nushell`
|
||||
date?: datetime # the date of the last release (default to 3 weeks ago, excluded)
|
||||
--label: string # the label to filter the PRs by, e.g. `good-first-issue`
|
||||
--pretty: bool # pretty-print for the MarkDown release not
|
||||
--no-author: bool # do not group the contributions by author
|
||||
] {
|
||||
let date = (
|
||||
if $date == null { (date now) - 3wk + 1day } else { $date }
|
||||
| date format "%Y-%m-%d"
|
||||
)
|
||||
|
||||
let query = if $label == null {
|
||||
$"merged:>($date)"
|
||||
} else {
|
||||
$"merged:>($date) label:($label)"
|
||||
}
|
||||
|
||||
let prs = (
|
||||
gh --repo $repo pr list
|
||||
--state merged
|
||||
--limit (inf | into int)
|
||||
--json author,title,number,mergedAt,url
|
||||
--search $query
|
||||
| from json
|
||||
| sort-by mergedAt --reverse
|
||||
| update author { get login }
|
||||
)
|
||||
|
||||
if $pretty {
|
||||
if $no_author {
|
||||
return (
|
||||
$prs | each {|pr|
|
||||
let link = (md-link $pr.number $pr.url)
|
||||
$"- ($link) ($pr.title)"
|
||||
}
|
||||
| str join "\n"
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
$prs
|
||||
| group-by author
|
||||
| transpose author prs
|
||||
| each {|line|
|
||||
let author = (md-link $line.author $"https://github.com/($line.author)")
|
||||
|
||||
$"- ($author) created" | append (
|
||||
$line.prs | each {|pr|
|
||||
let link = (md-link $pr.title $pr.url)
|
||||
$" - ($link)"
|
||||
}
|
||||
)
|
||||
| str join "\n"
|
||||
}
|
||||
| to text
|
||||
)
|
||||
}
|
||||
|
||||
$prs
|
||||
}
|
45
make_release/release-note/template.md
Normal file
45
make_release/release-note/template.md
Normal file
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
title: Nushell {{VERSION}}
|
||||
author: The Nu Authors
|
||||
author_site: https://twitter.com/nu_shell
|
||||
author_image: https://www.nushell.sh/blog/images/nu_logo.png
|
||||
excerpt: Today, we're releasing version {{VERSION}} of Nu. This release adds...
|
||||
---
|
||||
|
||||
# Nushell {{VERSION}}
|
||||
|
||||
Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your command line. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful command line pipelines.
|
||||
|
||||
Today, we're releasing version {{VERSION}} of Nu. This release adds...
|
||||
|
||||
<!-- more -->
|
||||
|
||||
# Where to get it
|
||||
|
||||
Nu {{VERSION}} is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/{{VERSION}}.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`.
|
||||
|
||||
NOTE: The optional dataframe functionality is available by `cargo install nu --features=dataframe`.
|
||||
|
||||
As part of this release, we also publish a set of optional plugins you can install and use with Nu. To install, use `cargo install nu_plugin_<plugin name>`.
|
||||
|
||||
# Themes of this release / New features
|
||||
|
||||
## New theme ([author](https://github.com/nushell/nushell/pulls))
|
||||
|
||||
# Breaking changes
|
||||
{{ TODO
|
||||
paste the output of
|
||||
```nu
|
||||
./make_release/release-note/list-merged-prs nushell/nushell --label breaking-change --pretty --no-author
|
||||
```
|
||||
here
|
||||
}}
|
||||
|
||||
# Full changelog
|
||||
{{ TODO
|
||||
paste the output of
|
||||
```nu
|
||||
./make_release/release-note/get-full-changelog
|
||||
```
|
||||
here
|
||||
}}
|
|
@ -1,58 +0,0 @@
|
|||
# http get https://api.github.com/repos/nushell/nushell/pulls?q=is%3Apr+merged%3A%3E%3D2021-04-20+ | select html_url user.login title body
|
||||
# http get https://api.github.com/search/issues?q=repo:nushell/nushell+is:pr+is:merged+merged:%3E2021-05-08 | get items | select html_url user.login title body
|
||||
# Repos to monitor
|
||||
|
||||
def query-release-span [] {
|
||||
let site_table = [
|
||||
[site repo];
|
||||
[Nushell nushell]
|
||||
[Extension vscode-nushell-lang]
|
||||
[Documentation nushell.github.io]
|
||||
[Wasm demo]
|
||||
[Nu_Scripts nu_scripts]
|
||||
[RFCs rfcs]
|
||||
[reedline reedline]
|
||||
# ] [Jupyter jupyter]
|
||||
]
|
||||
|
||||
let query_prefix = "https://api.github.com/search/issues?q=repo:nushell/"
|
||||
let query_date = (seq date --days 21 -r | get 20)
|
||||
let per_page = "100"
|
||||
let page_num = "1" # need to implement iterating pages
|
||||
let colon = "%3A"
|
||||
let gt = "%3E"
|
||||
let eq = "%3D"
|
||||
let amp = "%26"
|
||||
let query_suffix = $"+is($colon)pr+is($colon)merged+merged($colon)($gt)($eq)($query_date)&per_page=($per_page)&page=($page_num)"
|
||||
|
||||
for repo in $site_table {
|
||||
let query_string = $"($query_prefix)($repo.repo)($query_suffix)"
|
||||
let site_json = (http get -u $env.GITHUB_USERNAME -p $env.GITHUB_PASSWORD $query_string | get items | select html_url user.login title)
|
||||
|
||||
if not ($site_json | all { |it| $it | is-empty }) {
|
||||
print $"(char nl)## ($repo.site)(char nl)"
|
||||
|
||||
for user in ($site_json | group-by user_login | transpose user prs) {
|
||||
let user_name = $user.user
|
||||
let pr_count = ($user.prs | length)
|
||||
|
||||
print -n $"- ($user_name) created "
|
||||
for pr in ($user.prs | enumerate) {
|
||||
if $pr_count == ($pr.index + 1) {
|
||||
print -n $"[($pr.item.title)](char lparen)($pr.item.html_url)(char rparen)"
|
||||
} else {
|
||||
print -n $"[($pr.item.title)](char lparen)($pr.item.html_url)(char rparen), and "
|
||||
}
|
||||
}
|
||||
|
||||
print ""
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($env | select GITHUB_USERNAME | is-empty) or ($env | select GITHUB_PASSWORD | is-empty) {
|
||||
print 'Please set GITHUB_USERNAME and GITHUB_PASSWORD in $env to use this script'
|
||||
} else {
|
||||
query-release-span
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue