mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 22:57:46 +00:00
FEATURE: add release note PR script to make_release/
(#506)
* add a script to create the release note PR of the website * make the script executable * pass the PR data to the open-pr command in a record * add instructions to run the script in the readme * move the core of the instructions to the help of the script * refactor the repo cleaning in a tool command * link to the repo if the user is not logged into `gh` we also clean the repo in that case.
This commit is contained in:
parent
272b7e2b93
commit
394e625837
2 changed files with 136 additions and 1 deletions
|
@ -4,4 +4,10 @@
|
|||
```rust
|
||||
cd <your nushell repo>
|
||||
nu nu_deps.nu
|
||||
```
|
||||
```
|
||||
|
||||
### Create the release note PR on the website
|
||||
see
|
||||
```nu
|
||||
./make_release/create-website-release-note-pr --help
|
||||
```
|
||||
|
|
129
make_release/create-website-release-note-pr
Executable file
129
make_release/create-website-release-note-pr
Executable file
|
@ -0,0 +1,129 @@
|
|||
#!/usr/bin/env nu
|
||||
|
||||
use std [
|
||||
"log info"
|
||||
"log error"
|
||||
]
|
||||
|
||||
def open-pr [
|
||||
repo: path
|
||||
remote: string
|
||||
pr: record<
|
||||
branch: string
|
||||
title: string
|
||||
body: string
|
||||
>
|
||||
] {
|
||||
cd $repo
|
||||
gh repo set-default $remote
|
||||
|
||||
log info "mock up pr"
|
||||
(
|
||||
gh pr create
|
||||
--head $pr.branch
|
||||
--base main
|
||||
--title $pr.title
|
||||
--body $pr.body
|
||||
--draft
|
||||
)
|
||||
}
|
||||
|
||||
def clean [repo: path] {
|
||||
log info "removing the repo"
|
||||
rm -rf $repo
|
||||
}
|
||||
|
||||
# open the release note PR interactively
|
||||
#
|
||||
# # 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
|
||||
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`
|
||||
] {
|
||||
let repo = ($nu.temp-path | path join (random uuid))
|
||||
let branch = $"release-notes-($version)"
|
||||
|
||||
let blog_path = (
|
||||
$repo | path join "blog" $"($date | date format "%Y-%m-%d")-nushell_($version | str replace --all --string '.' '_').md"
|
||||
)
|
||||
|
||||
let title = $"Release notes for `($version)`"
|
||||
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
|
||||
|
||||
log info "creating release branch"
|
||||
git -C $repo checkout -b $branch nushell/main
|
||||
|
||||
log info "creating release note from template"
|
||||
$release_note_template
|
||||
| str replace --all --string "{{VERSION}}" $version
|
||||
| save --force $blog_path
|
||||
|
||||
log info "commiting release note"
|
||||
git -C $repo add $blog_path
|
||||
git -C $repo commit -m $"($title)\n\n($body)"
|
||||
|
||||
log info "pushing release note to nushell"
|
||||
git -C $repo push nushell $branch
|
||||
|
||||
let out = (do -i { gh auth status } | complete)
|
||||
if $out.exit_code != 0 {
|
||||
clean $repo
|
||||
|
||||
let pr_url = $"https://github.com/nushell/nushell.github.io/compare/($branch)?expand=1"
|
||||
error make --unspanned {
|
||||
msg: ([
|
||||
$out.stderr
|
||||
$"please open the PR manually from a browser (ansi blue_underline)($pr_url | ansi link --text 'here')(ansi reset)"
|
||||
] | str join "\n")
|
||||
}
|
||||
}
|
||||
|
||||
log info "opening pull request"
|
||||
open-pr $repo nushell/nushell.github.io {
|
||||
branch: $"nushell:($branch)"
|
||||
title: $title
|
||||
body: $body
|
||||
}
|
||||
|
||||
clean $repo
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue