From 798289ff68b76a6f5c9950eca6597a8708ce76ad Mon Sep 17 00:00:00 2001 From: hustcer Date: Wed, 11 Jun 2025 07:13:11 +0800 Subject: [PATCH 1/4] chore: bump version to 0.105.0 --- Justfile | 5 +++++ meta.json | 6 +++--- nu/bump-ver.nu | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 3 deletions(-) create mode 100644 nu/bump-ver.nu diff --git a/Justfile b/Justfile index e6e0eb690..f7eaffb78 100644 --- a/Justfile +++ b/Justfile @@ -35,6 +35,11 @@ _query_plugin := if os_family() == 'windows' { 'nu_plugin_query.exe' } else { 'n default: @just --list --list-prefix "··· " +# Bump Nushell version for supported Linux distributions +bump *OPTIONS: + @overlay use {{ join(NU_DISTRO_PATH, 'nu', 'bump-ver.nu') }}; \ + bump-version {{OPTIONS}} + # Release a new version for Nushell release *OPTIONS: @overlay use {{ join(NU_DISTRO_PATH, 'nu', 'release.nu') }}; \ diff --git a/meta.json b/meta.json index 4236e7eb8..85d7ac7eb 100644 --- a/meta.json +++ b/meta.json @@ -1,7 +1,7 @@ { "name": "nushell", - "version": "0.104.1", - "revision": "0", + "version": "0.105.0", + "revision": 0, "pkgs": { "deb": true, "rpm": true, @@ -13,4 +13,4 @@ "github": "https://github.com/nushell/nushell", "home": "https://www.nushell.sh", "description": "A new type of shell." -} +} \ No newline at end of file diff --git a/nu/bump-ver.nu b/nu/bump-ver.nu new file mode 100644 index 000000000..7e2f69910 --- /dev/null +++ b/nu/bump-ver.nu @@ -0,0 +1,38 @@ +#!/usr/bin/env nu + +# TODO: +# - [√] Check if the tag of the specified version already exists in local git repository + +export def bump-version [ + version: string, + --revision: int = 0, # Revision number for the version, default is 0 +] { + if not ($version | str replace -ar '^(\d+\.)?(\d+\.)?(\*|\d+)$' '' | is-empty) { + print $'(ansi r)Invalid version number: ($version)(ansi reset)' + exit 7 + } + + if (has-ref $'($version)') { + print $'(ansi r)The tag of the specified version already exists: ($version)(ansi reset)' + exit 5 + } + + open meta.json + | update version $version + | update revision $revision + | save -f meta.json + git commit -am $'chore: bump version to ($version)' + git tag -am $'chore: bump version to ($version)' $version + git push --follow-tags +} + +# Check if a git repo has the specified ref: could be a branch or tag, etc. +export def has-ref [ + ref: string # The git ref to check +] { + let checkRepo = (do -i { git rev-parse --is-inside-work-tree } | complete) + if not ($checkRepo.stdout =~ 'true') { return false } + # Brackets were required here, or error will occur + let parse = (do -i { git rev-parse --verify -q $ref } | complete) + if ($parse.stdout | is-empty) { false } else { true } +} From 5baae154aaff4eb8bee1350dbce58bcd00727873 Mon Sep 17 00:00:00 2001 From: hustcer Date: Wed, 11 Jun 2025 07:16:32 +0800 Subject: [PATCH 2/4] chore: bump version to 0.105.1 --- meta.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta.json b/meta.json index 85d7ac7eb..af4545f12 100644 --- a/meta.json +++ b/meta.json @@ -1,6 +1,6 @@ { "name": "nushell", - "version": "0.105.0", + "version": "0.105.1", "revision": 0, "pkgs": { "deb": true, From 9262ab6abe0353bd47ee7407a9d5b229bd4c6505 Mon Sep 17 00:00:00 2001 From: hustcer Date: Wed, 11 Jun 2025 07:25:35 +0800 Subject: [PATCH 3/4] fix: Fix version bump script --- nu/bump-ver.nu | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nu/bump-ver.nu b/nu/bump-ver.nu index 7e2f69910..c344db220 100644 --- a/nu/bump-ver.nu +++ b/nu/bump-ver.nu @@ -12,7 +12,7 @@ export def bump-version [ exit 7 } - if (has-ref $'($version)') { + if (has-ref $'($version)-($revision)') { print $'(ansi r)The tag of the specified version already exists: ($version)(ansi reset)' exit 5 } @@ -21,8 +21,8 @@ export def bump-version [ | update version $version | update revision $revision | save -f meta.json - git commit -am $'chore: bump version to ($version)' - git tag -am $'chore: bump version to ($version)' $version + git commit -am $'chore: bump version to ($version) of revision ($revision)' + git tag -am $'chore: bump version to ($version)' $'($version)-($revision)' git push --follow-tags } From c65076197e55e488af9ef78ba2dddeba328a7afc Mon Sep 17 00:00:00 2001 From: hustcer Date: Wed, 11 Jun 2025 07:35:32 +0800 Subject: [PATCH 4/4] Fix publish of Nushell packages --- .github/workflows/publish.yml | 8 +++++--- nu/release.nu | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 36c55d28e..2c6eddc7a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -50,6 +50,7 @@ jobs: run: | use ${{ github.workspace }}/nu/release.nu * version | print + let version = open meta.json | get version echo $env.SIGNING_KEY o> key.gpg # $env | print let arch = match $env.RUNNER_ARCH { @@ -57,7 +58,7 @@ jobs: 'ARM64' => 'arm64', _ => 'amd64' } - fetch release $arch + fetch release $arch $version publish pkg $arch --create-release rm key.gpg @@ -93,10 +94,11 @@ jobs: run: | use ${{ github.workspace }}/nu/release.nu * version | print + let version = open meta.json | get version echo $env.SIGNING_KEY o> key.gpg - fetch release riscv64 + fetch release riscv64 $version publish pkg riscv64 --create-release - fetch release loongarch64 + fetch release loongarch64 $version publish pkg loongarch64 --create-release rm key.gpg diff --git a/nu/release.nu b/nu/release.nu index 8d630643c..29f61a12c 100644 --- a/nu/release.nu +++ b/nu/release.nu @@ -24,7 +24,8 @@ const RELEASE_QUERY_URL = 'https://api.github.com/repos/nushell/nushell/releases # Fetch the latest Nushell release package from GitHub export def 'fetch release' [ - arch: string, # The target architecture, e.g. amd64 & arm64 + arch: string, # The target architecture, e.g. amd64 & arm64 + version: string, # The Nushell version to fetch, e.g. 0.105.0 ] { const ARCH_MAP = { amd64: 'x86_64-unknown-linux-musl', @@ -41,7 +42,8 @@ export def 'fetch release' [ ] let assets = http get -H $BASE_HEADER $RELEASE_QUERY_URL | sort-by -r created_at - | select name created_at assets + | select name tag_name created_at assets + | where tag_name =~ $version | get 0 | get assets.browser_download_url let download_url = $assets | where $it =~ ($ARCH_MAP | get $arch) | get 0