mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
add a script to bump the version of Nushell (#565)
* add `bump-version.nu` to bump a version automatically * mention `bump-version` in the release guide insted of `sd` * remove the Note about `sd`ing the `Cargo.lock` file * break very long lines * find and replace in the `.nu` config files only * fix the `str expand` command call for windows it appears to not work properly with the `\` introduced by `path join`.
This commit is contained in:
parent
9a459565bb
commit
f4f765a946
2 changed files with 46 additions and 4 deletions
|
@ -24,9 +24,8 @@
|
|||
- [ ] bump the version on the Nushell side ([example with `reedline`][reedline pin example]) (reference the release notes for courtesy)
|
||||
|
||||
## 1. Minor bump of the version ([example][nushell bump example])
|
||||
- [ ] bump the version with `sd 'version = "0.xx.1"' 'version = "0.xx+1.0"' **/Cargo.toml`
|
||||
- [ ] bump the version info in the default configs with `sd 'version = 0.xx.1' 'version = 0.xx+1.0' **/*.nu`
|
||||
- [ ] Also commit `Cargo.lock` AFTER running a cargo command (or update via `sd 'version = "0.xx.1"' 'version = "0.xx+1.0"' **/Cargo.lock` assuming no other package carries that version specifier)
|
||||
- [ ] in the repo of Nushell, run `/path/to/nu_scripts/make_release/bump-version.nu`
|
||||
- [ ] Also commit `Cargo.lock` AFTER running a Cargo command like `cargo check --workspace`
|
||||
|
||||
## 2. Tag the [`nushell`] repo
|
||||
> **Warning**
|
||||
|
@ -86,7 +85,10 @@
|
|||
- [ ] run `./make_release/release-note/create-pr 0.xx.0 ((date now) + 4wk | date format "%Y-%m-%d" | into datetime)`
|
||||
|
||||
## 8. Bump the version as development
|
||||
- [ ] bump the patch version on [`nushell`] ([example][nushell dev example])
|
||||
- [ ] bump the patch version on [`nushell`] ([example][nushell dev example]) by running
|
||||
```nushell
|
||||
/path/to/nu_scripts/make_release/bump-version.nu --patch
|
||||
```
|
||||
|
||||
|
||||
[reedline bump example]: https://github.com/nushell/reedline/pull/596/files
|
||||
|
|
40
make_release/bump-version.nu
Executable file
40
make_release/bump-version.nu
Executable file
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/env nu
|
||||
use std log
|
||||
|
||||
# bump the minor or patch version of the Nushell project
|
||||
def main [
|
||||
--patch: bool # update the minor version instead of the minor
|
||||
]: nothing -> nothing {
|
||||
let version = open Cargo.toml
|
||||
| get package.version
|
||||
| parse "{major}.{minor}.{patch}"
|
||||
| into int major minor patch
|
||||
| into record
|
||||
|
||||
let new_version = if $patch {
|
||||
$version | update patch { $in + 1 }
|
||||
} else {
|
||||
$version | update minor { $in + 1 } | update patch { 0 }
|
||||
}
|
||||
|
||||
let version = $version | transpose | get column1 | str join "."
|
||||
let new_version = $new_version | transpose | get column1 | str join "."
|
||||
|
||||
log info $"bumping all packages and Nushell files in (open Cargo.toml | get package.name) from ($version) to ($new_version)"
|
||||
|
||||
ls **/Cargo.toml | each {|file|
|
||||
log debug $"bumping ($file.name) from ($version) to ($new_version)"
|
||||
open --raw $file.name
|
||||
| str replace --all --string $'version = "($version)"' $'version = "($new_version)"'
|
||||
| save --force $file.name
|
||||
}
|
||||
|
||||
"crates/nu-utils/src/sample_config/default_{config,env}.nu" | str expand | each {|file|
|
||||
log debug $"bumping ($file) from ($version) to ($new_version)"
|
||||
open --raw $file
|
||||
| str replace --all --string $'version = ($version)' $'version = ($new_version)'
|
||||
| save --force $file
|
||||
}
|
||||
|
||||
null
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue