File tree Expand file tree Collapse file tree 5 files changed +55
-8
lines changed Expand file tree Collapse file tree 5 files changed +55
-8
lines changed Original file line number Diff line number Diff line change @@ -50,14 +50,15 @@ jobs:
5050 run : |
5151 use ${{ github.workspace }}/nu/release.nu *
5252 version | print
53+ let version = open meta.json | get version
5354 echo $env.SIGNING_KEY o> key.gpg
5455 # $env | print
5556 let arch = match $env.RUNNER_ARCH {
5657 'X64' => 'amd64',
5758 'ARM64' => 'arm64',
5859 _ => 'amd64'
5960 }
60- fetch release $arch
61+ fetch release $arch $version
6162 publish pkg $arch --create-release
6263 rm key.gpg
6364
@@ -93,10 +94,11 @@ jobs:
9394 run : |
9495 use ${{ github.workspace }}/nu/release.nu *
9596 version | print
97+ let version = open meta.json | get version
9698 echo $env.SIGNING_KEY o> key.gpg
97- fetch release riscv64
99+ fetch release riscv64 $version
98100 publish pkg riscv64 --create-release
99- fetch release loongarch64
101+ fetch release loongarch64 $version
100102 publish pkg loongarch64 --create-release
101103 rm key.gpg
102104
Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ _query_plugin := if os_family() == 'windows' { 'nu_plugin_query.exe' } else { 'n
3535default :
3636 @ just --list --list-prefix " ··· "
3737
38+ # Bump Nushell version for supported Linux distributions
39+ bump * OPTIONS :
40+ @ overlay use {{ join (NU_DISTRO_PATH, ' nu' , ' bump-ver.nu' ) }} ; \
41+ bump-version {{ OPTIONS}}
42+
3843# Release a new version for Nushell
3944release * OPTIONS :
4045 @ overlay use {{ join (NU_DISTRO_PATH, ' nu' , ' release.nu' ) }} ; \
Original file line number Diff line number Diff line change 11{
22 "name" : " nushell" ,
3- "version" : " 0.104 .1" ,
4- "revision" : " 0 " ,
3+ "version" : " 0.105 .1" ,
4+ "revision" : 0 ,
55 "pkgs" : {
66 "deb" : true ,
77 "rpm" : true ,
1313 "github" : " https://github.com/nushell/nushell" ,
1414 "home" : " https://www.nushell.sh" ,
1515 "description" : " A new type of shell."
16- }
16+ }
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env nu
2+
3+ # TODO:
4+ # - [√] Check if the tag of the specified version already exists in local git repository
5+
6+ export def bump-version [
7+ version : string ,
8+ -- revision : int = 0 , # Revision number for the version, default is 0
9+ ] {
10+ if not ($version | str replace - ar ' ^(\d+\.)?(\d+\.)?(\*|\d+)$' ' ' | is-empty ) {
11+ print $' (ansi r )Invalid version number: ($version )(ansi reset )'
12+ exit 7
13+ }
14+
15+ if (has-ref $' ($version )-($revision )' ) {
16+ print $' (ansi r )The tag of the specified version already exists: ($version )(ansi reset )'
17+ exit 5
18+ }
19+
20+ open meta.json
21+ | update version $version
22+ | update revision $revision
23+ | save - f meta.json
24+ git commit - am $' chore: bump version to ($version ) of revision ($revision )'
25+ git tag - am $' chore: bump version to ($version )' $' ($version )-($revision )'
26+ git push -- follow-tags
27+ }
28+
29+ # Check if a git repo has the specified ref: could be a branch or tag, etc.
30+ export def has-ref [
31+ ref : string # The git ref to check
32+ ] {
33+ let checkRepo = (do - i { git rev-parse -- is-inside-work-tree } | complete )
34+ if not ($checkRepo.stdout =~ ' true' ) { return false }
35+ # Brackets were required here, or error will occur
36+ let parse = (do - i { git rev-parse -- verify - q $ref } | complete )
37+ if ($parse.stdout | is-empty ) { false } else { true }
38+ }
Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ const RELEASE_QUERY_URL = 'https://api.github.com/repos/nushell/nushell/releases
2424
2525# Fetch the latest Nushell release package from GitHub
2626export def 'fetch release' [
27- arch : string , # The target architecture, e.g. amd64 & arm64
27+ arch : string , # The target architecture, e.g. amd64 & arm64
28+ version : string , # The Nushell version to fetch, e.g. 0.105.0
2829] {
2930 const ARCH_MAP = {
3031 amd64 : ' x86_64-unknown-linux-musl' ,
@@ -41,7 +42,8 @@ export def 'fetch release' [
4142 ]
4243 let assets = http get - H $BASE_HEADER $RELEASE_QUERY_URL
4344 | sort-by - r created_at
44- | select name created_at assets
45+ | select name tag_name created_at assets
46+ | where tag_name =~ $version
4547 | get 0
4648 | get assets.browser_download_url
4749 let download_url = $assets | where $it =~ ($ARCH_MAP | get $arch ) | get 0
You can’t perform that action at this time.
0 commit comments