From b8181c5caeb1be0adff1b4de9e4adc1b601cdad1 Mon Sep 17 00:00:00 2001 From: Justin Ma Date: Fri, 8 Mar 2024 12:50:22 +0800 Subject: [PATCH] Upgrade Nu to v0.91 for release and nightly workflow (#12114) Upgrade Nu to v0.91 for release and nightly workflow A workflow running result example could be found here: https://github.com/nushell/nightly/actions/runs/8198411468 --- .github/workflows/nightly-build.yml | 8 ++++---- .github/workflows/release-pkg.nu | 23 ++++++++++++----------- .github/workflows/release.yml | 4 ++-- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 08f2880ac0..03c5a07547 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -39,7 +39,7 @@ jobs: uses: hustcer/setup-nu@v3.9 if: github.repository == 'nushell/nightly' with: - version: 0.90.1 + version: 0.91.0 # Synchronize the main branch of nightly repo with the main branch of Nushell official repo - name: Prepare for Nightly Release @@ -141,7 +141,7 @@ jobs: - name: Setup Nushell uses: hustcer/setup-nu@v3.9 with: - version: 0.90.1 + version: 0.91.0 - name: Release Nu Binary id: nu @@ -253,7 +253,7 @@ jobs: - name: Setup Nushell uses: hustcer/setup-nu@v3.9 with: - version: 0.90.1 + version: 0.91.0 - name: Release Nu Binary id: nu @@ -317,7 +317,7 @@ jobs: - name: Setup Nushell uses: hustcer/setup-nu@v3.9 with: - version: 0.90.1 + version: 0.91.0 # Keep the last a few releases - name: Delete Older Releases diff --git a/.github/workflows/release-pkg.nu b/.github/workflows/release-pkg.nu index eab8a77d86..e23651753d 100755 --- a/.github/workflows/release-pkg.nu +++ b/.github/workflows/release-pkg.nu @@ -71,7 +71,7 @@ const FULL_RLS_NAMING = { # $env -let USE_UBUNTU = 'ubuntu-20.04' +let USE_UBUNTU = $os starts-with ubuntu let FULL_NAME = $FULL_RLS_NAMING | get -i $target | default 'unknown-target-full' print $'(char nl)Packaging ($bin) v($version) for ($target) in ($src)...'; hr-line -b @@ -82,8 +82,8 @@ print $'Start building ($bin)...'; hr-line # ---------------------------------------------------------------------------- # Build for Ubuntu and macOS # ---------------------------------------------------------------------------- -if $os in [$USE_UBUNTU, 'macos-latest', 'ubuntu-latest'] { - if $os starts-with ubuntu { +if $os in ['macos-latest'] or $USE_UBUNTU { + if $USE_UBUNTU { sudo apt update sudo apt-get install libxcb-composite0-dev -y } @@ -106,7 +106,7 @@ if $os in [$USE_UBUNTU, 'macos-latest', 'ubuntu-latest'] { _ => { # musl-tools to fix 'Failed to find tool. Is `musl-gcc` installed?' # Actually just for x86_64-unknown-linux-musl target - if $os starts-with ubuntu { sudo apt install musl-tools -y } + if $USE_UBUNTU { sudo apt install musl-tools -y } cargo-build-nu $flags } } @@ -128,16 +128,16 @@ let executable = $'target/($target)/release/($bin)*($suffix)' print $'Current executable file: ($executable)' cd $src; mkdir $dist; -rm -rf $'target/($target)/release/*.d' $'target/($target)/release/nu_pretty_hex*' +rm -rf ...(glob $'target/($target)/release/*.d') ...(glob $'target/($target)/release/nu_pretty_hex*') print $'(char nl)All executable files:'; hr-line # We have to use `print` here to make sure the command output is displayed -print (ls -f $executable); sleep 1sec +print (ls -f ($executable | into glob)); sleep 1sec print $'(char nl)Copying release files...'; hr-line "To use Nu plugins, use the register command to tell Nu where to find the plugin. For example: > register ./nu_plugin_query" | save $'($dist)/README.txt' -f -[LICENSE $executable] | each {|it| cp -rv $it $dist } | flatten +[LICENSE ...(glob $executable)] | each {|it| cp -rv $it $dist } | flatten print $'(char nl)Check binary release version detail:'; hr-line let ver = if $os == 'windows-latest' { @@ -153,7 +153,7 @@ if ($ver | str trim | is-empty) { # Create a release archive and send it to output for the following steps # ---------------------------------------------------------------------------- cd $dist; print $'(char nl)Creating release archive...'; hr-line -if $os in [$USE_UBUNTU, 'macos-latest', 'ubuntu-latest'] { +if $os in ['macos-latest'] or $USE_UBUNTU { let files = (ls | get name) let dest = if $env.RELEASE_TYPE == 'full' { $'($bin)-($version)-($FULL_NAME)' } else { $'($bin)-($version)-($target)' } @@ -181,10 +181,11 @@ if $os in [$USE_UBUNTU, 'macos-latest', 'ubuntu-latest'] { if (get-env _EXTRA_) == 'msi' { let wixRelease = $'($src)/target/wix/($releaseStem).msi' - print $'(char nl)Start creating Windows msi package...' + print $'(char nl)Start creating Windows msi package with the following contents...' cd $src; hr-line # Wix need the binaries be stored in target/release/ - cp -r $'($dist)/*' target/release/ + cp -r ($'($dist)/*' | into glob) target/release/ + ls target/release/* | print cargo install cargo-wix --version 0.3.4 cargo wix --no-build --nocapture --package nu --output $wixRelease # Workaround for https://github.com/softprops/action-gh-release/issues/280 @@ -196,7 +197,7 @@ if $os in [$USE_UBUNTU, 'macos-latest', 'ubuntu-latest'] { print $'(char nl)(ansi g)Archive contents:(ansi reset)'; hr-line; ls let archive = $'($dist)/($releaseStem).zip' - 7z a $archive * + 7z a $archive ...(glob *) let pkg = (ls -f $archive | get name) if not ($pkg | is-empty) { # Workaround for https://github.com/softprops/action-gh-release/issues/280 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a8bee58fbe..c03bcd12b9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -87,7 +87,7 @@ jobs: - name: Setup Nushell uses: hustcer/setup-nu@v3.9 with: - version: 0.90.1 + version: 0.91.0 - name: Release Nu Binary id: nu @@ -176,7 +176,7 @@ jobs: - name: Setup Nushell uses: hustcer/setup-nu@v3.9 with: - version: 0.90.1 + version: 0.91.0 - name: Release Nu Binary id: nu