Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ 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 {
'X64' => 'amd64',
'ARM64' => 'arm64',
_ => 'amd64'
}
fetch release $arch
fetch release $arch $version
publish pkg $arch --create-release
rm key.gpg

Expand Down Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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') }}; \
Expand Down
6 changes: 3 additions & 3 deletions meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nushell",
"version": "0.104.1",
"revision": "0",
"version": "0.105.1",
"revision": 0,
"pkgs": {
"deb": true,
"rpm": true,
Expand All @@ -13,4 +13,4 @@
"github": "https://github.com/nushell/nushell",
"home": "https://www.nushell.sh",
"description": "A new type of shell."
}
}
38 changes: 38 additions & 0 deletions nu/bump-ver.nu
Original file line number Diff line number Diff line change
@@ -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)-($revision)') {
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) of revision ($revision)'
git tag -am $'chore: bump version to ($version)' $'($version)-($revision)'
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 }
}
6 changes: 4 additions & 2 deletions nu/release.nu
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
Expand Down
Loading