diff --git a/make_release/Readme.md b/make_release/Readme.md index 44e1a52..1edec8a 100644 --- a/make_release/Readme.md +++ b/make_release/Readme.md @@ -6,8 +6,30 @@ cd 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 ``` diff --git a/make_release/create-website-release-note-pr b/make_release/release-note/create-pr similarity index 62% rename from make_release/create-website-release-note-pr rename to make_release/release-note/create-pr index c8bcec7..2e5c5e5 100755 --- a/make_release/create-website-release-note-pr +++ b/make_release/release-note/create-pr @@ -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... - - - -# 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_`. - -# 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 diff --git a/make_release/release-note/get-full-changelog b/make_release/release-note/get-full-changelog new file mode 100755 index 0000000..0c87bc3 --- /dev/null +++ b/make_release/release-note/get-full-changelog @@ -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" +} diff --git a/make_release/release-note/list-merged-prs b/make_release/release-note/list-merged-prs new file mode 100755 index 0000000..221cab3 --- /dev/null +++ b/make_release/release-note/list-merged-prs @@ -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 +} diff --git a/make_release/release-note/template.md b/make_release/release-note/template.md new file mode 100644 index 0000000..a87f336 --- /dev/null +++ b/make_release/release-note/template.md @@ -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... + + + +# 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_`. + +# 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 +}} diff --git a/make_release/since_last_release.nu b/make_release/since_last_release.nu deleted file mode 100644 index 0318ac8..0000000 --- a/make_release/since_last_release.nu +++ /dev/null @@ -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 -}