From 983d5b6cd503df4be6e2c755921ee72ae3d6a4d0 Mon Sep 17 00:00:00 2001 From: hustcer Date: Sun, 4 May 2025 19:33:52 +0800 Subject: [PATCH 01/15] Add wix/main.wixproj for wix toolset 6.0 --- wix/main.wixproj | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 wix/main.wixproj diff --git a/wix/main.wixproj b/wix/main.wixproj new file mode 100644 index 0000000000..cab83fb431 --- /dev/null +++ b/wix/main.wixproj @@ -0,0 +1,34 @@ + + + Package + nu-$(Platform) + 82D756D2-19FA-4F09-B10F-64942E89F364 + + SourceDir=$(MSBuildProjectDirectory)\nu + + true + ICE80 + + + + x64 + $(DefineConstants) + + + + arm64 + $(DefineConstants) + + + + + + + + + + + + + + From 9a809c966c83121812b2515bdec60db520801016 Mon Sep 17 00:00:00 2001 From: hustcer Date: Sun, 4 May 2025 20:59:57 +0800 Subject: [PATCH 02/15] chore: Update Copyright --- scripts/build.rs | 2 +- wix/License.rtf | Bin 1288 -> 1289 bytes 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build.rs b/scripts/build.rs index e366b4998c..714f931bdd 100644 --- a/scripts/build.rs +++ b/scripts/build.rs @@ -3,7 +3,7 @@ fn main() { let mut res = winresource::WindowsResource::new(); res.set("ProductName", "Nushell"); res.set("FileDescription", "Nushell"); - res.set("LegalCopyright", "Copyright (C) 2022"); + res.set("LegalCopyright", "Copyright (C) 2025"); res.set_icon("assets/nu_logo.ico"); res.compile() .expect("Failed to run the Windows resource compiler (rc.exe)"); diff --git a/wix/License.rtf b/wix/License.rtf index 54e26fad006a332a481e8a3f3ab2a83c18cb3c9f..9e78b15aefd7703836de3cac2c733b4ea7897dd7 100644 GIT binary patch delta 18 ZcmeC+>g1ZRVB$h8M$?UFY*?6hxd1foBNfKg%M0xd?9ji+r`05nqt!vFvP From 7264c664550f7a08483662b9778a4dc4c3a3e241 Mon Sep 17 00:00:00 2001 From: hustcer Date: Mon, 5 May 2025 09:24:16 +0800 Subject: [PATCH 03/15] chore: Update release-pkg.nu for MSI package building --- .github/workflows/release-pkg.nu | 61 ++++++++++++++----------------- wix/nu.ico | Bin 0 -> 7488 bytes 2 files changed, 27 insertions(+), 34 deletions(-) create mode 100644 wix/nu.ico diff --git a/.github/workflows/release-pkg.nu b/.github/workflows/release-pkg.nu index eee100425b..bc9f91820e 100755 --- a/.github/workflows/release-pkg.nu +++ b/.github/workflows/release-pkg.nu @@ -175,48 +175,41 @@ if $os in ['macos-latest'] or $USE_UBUNTU { tar -czf $archive $dest print $'archive: ---> ($archive)'; ls $archive # REF: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ - echo $"archive=($archive)" | save --append $env.GITHUB_OUTPUT + echo $"archive=($archive)(char nl)" o>> $env.GITHUB_OUTPUT } else if $os =~ 'windows' { let releaseStem = $'($bin)-($version)-($target)' - print $'(char nl)Download less related stuffs...'; hr-line - # todo: less-v661 is out but is released as a zip file. maybe we should switch to that and extract it? - aria2c https://github.com/jftuga/less-Windows/releases/download/less-v608/less.exe -o less.exe - # the below was renamed because it was failing to download for darren. it should work but it wasn't - # todo: maybe we should get rid of this aria2c dependency and just use http get? - #aria2c https://raw.githubusercontent.com/jftuga/less-Windows/master/LICENSE -o LICENSE-for-less.txt - aria2c https://github.com/jftuga/less-Windows/blob/master/LICENSE -o LICENSE-for-less.txt - - # Create Windows msi release package - if (get-env _EXTRA_) == 'msi' { - - let wixRelease = $'($src)/target/wix/($releaseStem).msi' - 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)/*' | into glob) target/release/ - ls target/release/* | print - cargo install cargo-wix --version 0.3.8 - cargo wix --no-build --nocapture --package nu --output $wixRelease + print $'(char nl)(ansi g)Archive contents:(ansi reset)'; hr-line; ls | print + let archive = $'($dist)/($releaseStem).zip' + 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 - let archive = ($wixRelease | str replace --all '\' '/') - print $'archive: ---> ($archive)'; - echo $"archive=($archive)" | save --append $env.GITHUB_OUTPUT + let archive = ($pkg | get 0 | str replace --all '\' '/') + print $'archive: ---> ($archive)' + echo $"archive=($archive)(char nl)" o>> $env.GITHUB_OUTPUT + } - } else { + # Create extra Windows msi release package if dotnet and wix are available + let installed = [dotnet wix] | all { (which $in | length) > 0 } + if $installed and (wix --version | split row . | first | into int) >= 6 { - print $'(char nl)(ansi g)Archive contents:(ansi reset)'; hr-line; ls | print - let archive = $'($dist)/($releaseStem).zip' - 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 - let archive = ($pkg | get 0 | str replace --all '\' '/') - print $'archive: ---> ($archive)' - echo $"archive=($archive)" | save --append $env.GITHUB_OUTPUT - } + print $'(char nl)Start creating Windows msi package with the following contents...' + cd $src; cd wix; hr-line; mkdir nu + # Wix need the binaries be stored in nu folder + cp -r ($'($dist)/*' | into glob) nu/ + ls -f nu/* | print + let arch = if $nu.os-info.arch =~ 'x86_64' { 'x64' } else { 'arm64' } + ./nu/nu.exe -c $'NU_RELEASE_VERSION=($version) dotnet build -c Release -p:Platform=($arch)' + glob **/*.msi | print + # Workaround for https://github.com/softprops/action-gh-release/issues/280 + let wixRelease = (glob **/*.msi | where $it =~ bin | get 0 | str replace --all '\' '/') + let msi = $'($wixRelease | path dirname)/nu-($version)-($target).msi' + mv $wixRelease $msi + print $'MSI archive: ---> ($msi)'; + echo $"msi=($msi)(char nl)" o>> $env.GITHUB_OUTPUT } } diff --git a/wix/nu.ico b/wix/nu.ico new file mode 100644 index 0000000000000000000000000000000000000000..b74f2a336c7286797fc5b2da0b98d1b2a82a27ad GIT binary patch literal 7488 zcmeG>CMAq=0nCkCqbY4he~+VX0-QC8fKT?pV6x z;otDSybo{Y%$a-6%-p##cV_Or007!k{a4Tclz`WC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tLgb#0-w2*V{zh4)n-hcQVWALx=}Y5x8alO-j1CI1yB1Bs=%uI7UK zOOO`+-DGe`@QNHPS3u86+7NVjr*EEJMd$}-P3BnDO{1} zGeje{Ox|`9cz`YT2ggkdvs2Y>bUjTlmE4V5SU2d&k4G37Ha!tAC>1+}rud>FRQG(< z!LK7fKGbmlO4MVdm?xu#jw|8g`a)

+j&@!zrF?CY=Atyg}DKaY9M6__XDf)bocV zcPZ!s>!fMo$RYX#15X%clF${n*^pBR1msV1x#1sP>a)Ey%YinOX{#D9(m=v)Ggy-` z$!vSDAtgY(a=Oluz(|qD5q99)&cq2*XxpN8rm7VFA5@a{FN4SrRyq;Ie zIA=c?>g4&a{O2TkFKp*zA=>k;y=HK8pe6*KfzAoYT?8VOz=k(ESr+aNmRs0T@d{1b zAQC{psF-9gl~nTBN#VelwI|_YR_8-cfFvr@$^FVf8-rZf6*rrqn!##HB4g_u3@Uy* zB;mxtu8WK-2%Sd*ml_ZP99T8y*V+|46(c)1wq($Zw=r4Dwu^Ocx%q-934P;x{vW=fGyD8Ad9vA4bOY+!c^@fS0>$PK zdX=OShF|6C2*b4MFNLb?Dh8x%N2siBpaY@)O+H6?3O;(C1sm!}N&p+c3)_~;=WI~{ z$E9^@D9=q|7JG#rw=|eS4cCP{jYiD>umPUVM2xjizgG`5Pj5jJsO$g1PJN+qMr}1} z<_~U=_LMzloIwjY@Zdh}KXLoyKpRjvf_`1gnjN|soyN`6Xr}{_w;x-dZ*0pU3s!Xx zDR94AeEkfVV^LZ-l8Q(5}>fDrZ;2We>n;moh+oo4S zQ-{6p)O7yktIDRz?L&w)U;TeJ>;G6nukw*dOqQ9KS&jSlDF+IW2P=OlmofhDe*n6_ B*OUMN literal 0 HcmV?d00001 From ea0b45390517a1bb469c0461b7493e37b66918c9 Mon Sep 17 00:00:00 2001 From: hustcer Date: Mon, 5 May 2025 09:35:08 +0800 Subject: [PATCH 04/15] Initial commit of wix/main.wxs --- wix/main.wxs | 600 +++++++++++++-------------------------------------- 1 file changed, 153 insertions(+), 447 deletions(-) diff --git a/wix/main.wxs b/wix/main.wxs index 9b7ea91e3a..1b745664fc 100644 --- a/wix/main.wxs +++ b/wix/main.wxs @@ -1,468 +1,174 @@ - - + - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. ---> + - - - - - - - - + + - + + + + + + - + - + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + - - - + + + + + + - - - - + + + + + + + - + + + - - + + - + + + + - - - - - - - "")]]> - - + + + - - - - - - - - - - - - - - - - - - - - + + + + + + From 34277a8c12348e16b76544eebe00532b15689409 Mon Sep 17 00:00:00 2001 From: hustcer Date: Mon, 5 May 2025 11:08:35 +0800 Subject: [PATCH 05/15] chore: Update nightly-build.yml workflow from nushell/nightly repo --- .github/workflows/nightly-build.yml | 101 ++++++++++++++++++++++------ 1 file changed, 79 insertions(+), 22 deletions(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 8da8cf9981..bd54241cab 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -4,17 +4,18 @@ # 2. https://github.com/JasonEtco/create-an-issue # 3. https://docs.github.com/en/actions/learn-github-actions/variables # 4. https://github.com/actions/github-script +# 5. https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_idneeds # name: Nightly Build on: - workflow_dispatch: push: branches: - nightly # Just for test purpose only with the nightly repo # This schedule will run only from the default branch schedule: - cron: '15 0 * * *' # run at 00:15 AM UTC + workflow_dispatch: defaults: run: @@ -26,6 +27,11 @@ jobs: runs-on: ubuntu-latest # This job is required by the release job, so we should make it run both from Nushell repo and nightly repo # if: github.repository == 'nushell/nightly' + # Map a step output to a job output + outputs: + skip: ${{ steps.vars.outputs.skip }} + build_date: ${{ steps.vars.outputs.build_date }} + nightly_tag: ${{ steps.vars.outputs.nightly_tag }} steps: - name: Checkout uses: actions/checkout@v4 @@ -58,16 +64,52 @@ jobs: # All the changes will be overwritten by the upstream main branch git reset --hard src/main git push origin main -f - let sha_short = (git rev-parse --short origin/main | str trim | str substring 0..7) - let tag_name = $'nightly-($sha_short)' - if (git ls-remote --tags origin $tag_name | is-empty) { - git tag -a $tag_name -m $'Nightly build from ($sha_short)' + + - name: Create Tag and Output Tag Name + if: github.repository == 'nushell/nightly' + id: vars + shell: nu {0} + run: | + let date = date now | format date %m%d + let version = open Cargo.toml | get package.version + let sha_short = (git rev-parse --short origin/main | str trim | str substring 0..6) + let latest_meta = http get https://api.github.com/repos/nushell/nightly/releases + | sort-by -r created_at + | where tag_name =~ nightly + | get tag_name?.0? | default '' + | parse '{version}-nightly.{build}+{hash}' + if ($latest_meta.0?.hash? | default '') == $sha_short { + print $'(ansi g)Latest nightly build is up-to-date, skip rebuilding.(ansi reset)' + $'skip=true(char nl)' o>> $env.GITHUB_OUTPUT + exit 0 + } + let prev_ver = $latest_meta.0?.version? | default '0.0.0' + let build = if ($latest_meta | is-empty) or ($version != $prev_ver) { 1 } else { + ($latest_meta | get build?.0? | default 0 | into int) + 1 + } + let nightly_tag = $'($version)-nightly.($build)+($sha_short)' + $'build_date=($date)(char nl)' o>> $env.GITHUB_OUTPUT + $'nightly_tag=($nightly_tag)(char nl)' o>> $env.GITHUB_OUTPUT + if (git ls-remote --tags origin $nightly_tag | is-empty) { + ls **/Cargo.toml | each {|file| + open --raw $file.name + | str replace --all $'version = "($version)"' $'version = "($version)-nightly.($build)"' + | save --force $file.name + } + # Disable the following two workflows for the automatic committed changes + rm .github/workflows/ci.yml + rm .github/workflows/audit.yml + git add . + git commit -m $'Update version to ($version)-nightly.($build)' + git tag -a $nightly_tag -m $'Nightly build from ($sha_short)' git push origin --tags + git push origin main -f } - standard: + release: name: Nu needs: prepare + if: needs.prepare.outputs.skip != 'true' strategy: fail-fast: false matrix: @@ -120,7 +162,6 @@ jobs: os: ubuntu-22.04 runs-on: ${{matrix.os}} - steps: - uses: actions/checkout@v4 with: @@ -132,7 +173,7 @@ jobs: echo "targets = ['${{matrix.target}}']" >> rust-toolchain.toml - name: Setup Rust toolchain and cache - uses: actions-rust-lang/setup-rust-toolchain@v1.12.0 + uses: actions-rust-lang/setup-rust-toolchain@v1 # WARN: Keep the rustflags to prevent from the winget submission error: `CAQuietExec: Error 0xc0000135` with: rustflags: '' @@ -153,7 +194,7 @@ jobs: - name: Create an Issue for Release Failure if: ${{ failure() }} - uses: JasonEtco/create-an-issue@v2.9.2 + uses: JasonEtco/create-an-issue@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -161,13 +202,6 @@ jobs: search_existing: open filename: .github/AUTO_ISSUE_TEMPLATE/nightly-build-fail.md - - name: Set Outputs of Short SHA - id: vars - run: | - echo "date=$(date -u +'%Y-%m-%d')" >> $GITHUB_OUTPUT - sha_short=$(git rev-parse --short HEAD) - echo "sha_short=${sha_short:0:7}" >> $GITHUB_OUTPUT - # REF: https://github.com/marketplace/actions/gh-release # Create a release only in nushell/nightly repo - name: Publish Archive @@ -176,8 +210,34 @@ jobs: with: prerelease: true files: ${{ steps.nu.outputs.archive }} - tag_name: nightly-${{ steps.vars.outputs.sha_short }} - name: Nu-nightly-${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha_short }} + tag_name: ${{ needs.prepare.outputs.nightly_tag }} + name: ${{ needs.prepare.outputs.build_date }}-${{ needs.prepare.outputs.nightly_tag }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + sha256sum: + needs: [prepare, release] + name: Create Sha256sum + runs-on: ubuntu-latest + if: github.repository == 'nushell/nightly' + steps: + - name: Download Release Archives + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: >- + gh release download ${{ needs.prepare.outputs.nightly_tag }} + --repo ${{ github.repository }} + --pattern '*' + --dir release + - name: Create Checksums + run: cd release && shasum -a 256 * > ../SHA256SUMS + - name: Publish Checksums + uses: softprops/action-gh-release@v2.0.9 + with: + draft: false + prerelease: true + files: SHA256SUMS + tag_name: ${{ needs.prepare.outputs.nightly_tag }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -185,12 +245,9 @@ jobs: name: Cleanup # Should only run in nushell/nightly repo if: github.repository == 'nushell/nightly' + needs: [release, sha256sum] runs-on: ubuntu-latest steps: - # Sleep for 30 minutes, waiting for the release to be published - - name: Waiting for Release - run: sleep 1800 - - uses: actions/checkout@v4 with: ref: main From f596fd749a0788d8e2be57c978b4afe54098d0b2 Mon Sep 17 00:00:00 2001 From: hustcer Date: Mon, 5 May 2025 12:33:02 +0800 Subject: [PATCH 06/15] Fix nightly workflow for building of MSI packages --- .github/workflows/nightly-build.yml | 64 +++++++++++++++++++++++------ 1 file changed, 52 insertions(+), 12 deletions(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index bd54241cab..4578b1a197 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -12,6 +12,7 @@ on: push: branches: - nightly # Just for test purpose only with the nightly repo + - fix/arm64-and-winget # This schedule will run only from the default branch schedule: - cron: '15 0 * * *' # run at 00:15 AM UTC @@ -99,6 +100,16 @@ jobs: # Disable the following two workflows for the automatic committed changes rm .github/workflows/ci.yml rm .github/workflows/audit.yml + + # Test the latest release script before merging + # TODO: Remove the following two lines after the test + git fetch origin + if ((git branch -r) =~ fix/arm64-and-winget) { + git checkout scripts/build.rs + git checkout origin/fix/arm64-and-winget wix + git checkout origin/fix/arm64-and-winget .github/workflows/release-pkg.nu + } + # ----------- REMOVE END OF TESTING ------------------ git add . git commit -m $'Update version to ($version)-nightly.($build)' git tag -a $nightly_tag -m $'Nightly build from ($sha_short)' @@ -126,24 +137,15 @@ jobs: - armv7-unknown-linux-musleabihf - riscv64gc-unknown-linux-gnu - loongarch64-unknown-linux-gnu - extra: ['bin'] include: - target: aarch64-apple-darwin os: macos-latest - target: x86_64-apple-darwin os: macos-latest - target: x86_64-pc-windows-msvc - extra: 'bin' - os: windows-latest - - target: x86_64-pc-windows-msvc - extra: msi os: windows-latest - target: aarch64-pc-windows-msvc - extra: 'bin' - os: windows-latest - - target: aarch64-pc-windows-msvc - extra: msi - os: windows-latest + os: windows-11-arm - target: x86_64-unknown-linux-gnu os: ubuntu-22.04 - target: x86_64-unknown-linux-musl @@ -168,6 +170,26 @@ jobs: ref: main fetch-depth: 0 + - name: Install Rustup for Windows ARM64 + shell: pwsh + if: ${{ matrix.os == 'windows-11-arm' }} + run: | + curl.exe -sSf -o rustup-init.exe https://win.rustup.rs + ./rustup-init.exe -y + echo "$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + $env:PATH = "$env:USERPROFILE\.cargo\bin;$env:PATH" + + - name: Install Wix Toolset 6 for Windows + shell: pwsh + if: ${{ startsWith(matrix.os, 'windows') }} + run: | + dotnet tool install --global wix --version 6.0.0 + dotnet workload install wix + $wixPath = "$env:USERPROFILE\.dotnet\tools" + echo "$wixPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + $env:PATH = "$wixPath;$env:PATH" + wix --version + - name: Update Rust Toolchain Target run: | echo "targets = ['${{matrix.target}}']" >> rust-toolchain.toml @@ -180,17 +202,31 @@ jobs: - name: Setup Nushell uses: hustcer/setup-nu@v3 + if: ${{ matrix.os != 'windows-11-arm' }} with: version: 0.103.0 - name: Release Nu Binary id: nu + if: ${{ matrix.os != 'windows-11-arm' }} run: nu .github/workflows/release-pkg.nu env: OS: ${{ matrix.os }} REF: ${{ github.ref }} TARGET: ${{ matrix.target }} - _EXTRA_: ${{ matrix.extra }} + + - name: Build Nu for Windows ARM64 + id: nu0 + shell: pwsh + if: ${{ matrix.os == 'windows-11-arm' }} + run: | + $env:OS = 'windows' + $env:REF = '${{ github.ref }}' + $env:TARGET = '${{ matrix.target }}' + cargo build --release --all --target aarch64-pc-windows-msvc + cp ./target/${{ matrix.target }}/release/nu.exe . + ./nu.exe -c 'version' + ./nu.exe ${{github.workspace}}/.github/workflows/release-pkg.nu - name: Create an Issue for Release Failure if: ${{ failure() }} @@ -209,7 +245,11 @@ jobs: if: ${{ startsWith(github.repository, 'nushell/nightly') }} with: prerelease: true - files: ${{ steps.nu.outputs.archive }} + files: | + ${{ steps.nu.outputs.msi }} + ${{ steps.nu0.outputs.msi }} + ${{ steps.nu.outputs.archive }} + ${{ steps.nu0.outputs.archive }} tag_name: ${{ needs.prepare.outputs.nightly_tag }} name: ${{ needs.prepare.outputs.build_date }}-${{ needs.prepare.outputs.nightly_tag }} env: From 5eef30ffcabd830133f924ed3df0dcae2748d09a Mon Sep 17 00:00:00 2001 From: hustcer Date: Mon, 5 May 2025 13:20:31 +0800 Subject: [PATCH 07/15] Fix cleanup step --- .github/workflows/nightly-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 4578b1a197..ccd055d845 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -302,7 +302,7 @@ jobs: shell: nu {0} run: | let KEEP_COUNT = 10 - let deprecated = (http get https://api.github.com/repos/nushell/nightly/releases | sort-by -r created_at | select tag_name id | range $KEEP_COUNT..) + let deprecated = (http get https://api.github.com/repos/nushell/nightly/releases | sort-by -r created_at | select tag_name id | slice $KEEP_COUNT..) for release in $deprecated { print $'Deleting tag ($release.tag_name)' git push origin --delete $release.tag_name From fcab8c20dfe7593ca626aceaa257f7d81793f560 Mon Sep 17 00:00:00 2001 From: hustcer Date: Tue, 6 May 2025 07:44:44 +0800 Subject: [PATCH 08/15] Enable UAC prompt when installing for all users --- wix/main.wxs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wix/main.wxs b/wix/main.wxs index 1b745664fc..7dea9e2ef2 100644 --- a/wix/main.wxs +++ b/wix/main.wxs @@ -34,6 +34,9 @@ + + + From 9813fee6d3f641d8d4413b1e108441209e8e6a03 Mon Sep 17 00:00:00 2001 From: hustcer Date: Tue, 6 May 2025 08:14:57 +0800 Subject: [PATCH 09/15] [ci skip] --- .github/workflows/release-pkg.nu | 2 +- wix/main.wxs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-pkg.nu b/.github/workflows/release-pkg.nu index bc9f91820e..a869bbbb62 100755 --- a/.github/workflows/release-pkg.nu +++ b/.github/workflows/release-pkg.nu @@ -202,7 +202,7 @@ if $os in ['macos-latest'] or $USE_UBUNTU { cp -r ($'($dist)/*' | into glob) nu/ ls -f nu/* | print let arch = if $nu.os-info.arch =~ 'x86_64' { 'x64' } else { 'arm64' } - ./nu/nu.exe -c $'NU_RELEASE_VERSION=($version) dotnet build -c Release -p:Platform=($arch)' + ./nu/nu.exe -c $'NU_RELEASE_VERSION=($version) dotnet build -c Release -p:Platform=($arch)' glob **/*.msi | print # Workaround for https://github.com/softprops/action-gh-release/issues/280 let wixRelease = (glob **/*.msi | where $it =~ bin | get 0 | str replace --all '\' '/') diff --git a/wix/main.wxs b/wix/main.wxs index 7dea9e2ef2..df2504d6f3 100644 --- a/wix/main.wxs +++ b/wix/main.wxs @@ -21,6 +21,7 @@ Manufacturer="$(var.Manufacturer)" > From 9855085fb701eee8751b97d3056f839af9528f97 Mon Sep 17 00:00:00 2001 From: hustcer Date: Tue, 6 May 2025 19:37:53 +0800 Subject: [PATCH 10/15] Update release workflow for MSI building --- .github/workflows/nightly-build.yml | 9 ------ .github/workflows/release.yml | 44 +++++++++++++++++++++-------- 2 files changed, 32 insertions(+), 21 deletions(-) diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index ccd055d845..f1806eb9a4 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -170,15 +170,6 @@ jobs: ref: main fetch-depth: 0 - - name: Install Rustup for Windows ARM64 - shell: pwsh - if: ${{ matrix.os == 'windows-11-arm' }} - run: | - curl.exe -sSf -o rustup-init.exe https://win.rustup.rs - ./rustup-init.exe -y - echo "$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - $env:PATH = "$env:USERPROFILE\.cargo\bin;$env:PATH" - - name: Install Wix Toolset 6 for Windows shell: pwsh if: ${{ startsWith(matrix.os, 'windows') }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6fcc71eebe..66f8968caa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,24 +35,15 @@ jobs: - armv7-unknown-linux-musleabihf - riscv64gc-unknown-linux-gnu - loongarch64-unknown-linux-gnu - extra: ['bin'] include: - target: aarch64-apple-darwin os: macos-latest - target: x86_64-apple-darwin os: macos-latest - target: x86_64-pc-windows-msvc - extra: 'bin' - os: windows-latest - - target: x86_64-pc-windows-msvc - extra: msi os: windows-latest - target: aarch64-pc-windows-msvc - extra: 'bin' - os: windows-latest - - target: aarch64-pc-windows-msvc - extra: msi - os: windows-latest + os: windows-11-arm - target: x86_64-unknown-linux-gnu os: ubuntu-22.04 - target: x86_64-unknown-linux-musl @@ -75,6 +66,17 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Install Wix Toolset 6 for Windows + shell: pwsh + if: ${{ startsWith(matrix.os, 'windows') }} + run: | + dotnet tool install --global wix --version 6.0.0 + dotnet workload install wix + $wixPath = "$env:USERPROFILE\.dotnet\tools" + echo "$wixPath" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + $env:PATH = "$wixPath;$env:PATH" + wix --version + - name: Update Rust Toolchain Target run: | echo "targets = ['${{matrix.target}}']" >> rust-toolchain.toml @@ -88,17 +90,31 @@ jobs: - name: Setup Nushell uses: hustcer/setup-nu@v3 + if: ${{ matrix.os != 'windows-11-arm' }} with: version: 0.103.0 - name: Release Nu Binary id: nu + if: ${{ matrix.os != 'windows-11-arm' }} run: nu .github/workflows/release-pkg.nu env: OS: ${{ matrix.os }} REF: ${{ github.ref }} TARGET: ${{ matrix.target }} - _EXTRA_: ${{ matrix.extra }} + + - name: Build Nu for Windows ARM64 + id: nu0 + shell: pwsh + if: ${{ matrix.os == 'windows-11-arm' }} + run: | + $env:OS = 'windows' + $env:REF = '${{ github.ref }}' + $env:TARGET = '${{ matrix.target }}' + cargo build --release --all --target aarch64-pc-windows-msvc + cp ./target/${{ matrix.target }}/release/nu.exe . + ./nu.exe -c 'version' + ./nu.exe ${{github.workspace}}/.github/workflows/release-pkg.nu # WARN: Don't upgrade this action due to the release per asset issue. # See: https://github.com/softprops/action-gh-release/issues/445 @@ -107,7 +123,11 @@ jobs: if: ${{ startsWith(github.ref, 'refs/tags/') }} with: draft: true - files: ${{ steps.nu.outputs.archive }} + files: | + ${{ steps.nu.outputs.msi }} + ${{ steps.nu0.outputs.msi }} + ${{ steps.nu.outputs.archive }} + ${{ steps.nu0.outputs.archive }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From deacd569ef03faee2d1e731d5b99b9f4dfa9d13a Mon Sep 17 00:00:00 2001 From: hustcer Date: Wed, 7 May 2025 08:11:51 +0800 Subject: [PATCH 11/15] Add WindowsTerminalProfile feature for installation --- wix/main.wixproj | 1 + wix/main.wxs | 121 +++++++++++++++++++++++++++++++++-------------- 2 files changed, 87 insertions(+), 35 deletions(-) diff --git a/wix/main.wixproj b/wix/main.wixproj index cab83fb431..77e48b12e7 100644 --- a/wix/main.wixproj +++ b/wix/main.wixproj @@ -29,6 +29,7 @@ + diff --git a/wix/main.wxs b/wix/main.wxs index df2504d6f3..88657b00f1 100644 --- a/wix/main.wxs +++ b/wix/main.wxs @@ -23,7 +23,7 @@ + DowngradeErrorMessage="A newer version of [ProductName] is already installed. Setup will now exit." /> @@ -54,6 +54,31 @@ + + + + + + + + + + + + + + + + + + @@ -92,35 +117,35 @@ + Name="PATH" + Value="[BINDIR]" + Permanent="no" + Part="last" + Action="set" + System="no" /> + Key="Software\nu" + Name="installed" + Type="integer" + Value="1" + KeyPath="yes" /> + Name="PATH" + Value="[BINDIR]" + Permanent="no" + Part="last" + Action="set" + System="yes" /> + Key="Software\nu" + Name="installed" + Type="integer" + Value="1" + KeyPath="yes" /> @@ -132,6 +157,14 @@ + + + + + @@ -153,26 +186,44 @@ Value="[INSTALLDIR_USER]" After="AppSearch" Condition="MSIINSTALLPERUSER=1" - Sequence="both"/> + Sequence="both" /> + Sequence="both" /> + Action="SetINSTALLDIR_Machine" + Value="[ProgramFiles64Folder][ApplicationFolderName]" + After="AppSearch" + Condition="ALLUSERS=1" + Sequence="both" /> + Action="SetBINDIR_Machine" + Value="[ProgramFiles64Folder][ApplicationFolderName]\bin" + After="AppSearch" + Condition="ALLUSERS=1" + Sequence="both" /> + + + + + + + + + From 9070f8be2d602ac56c15567d41836b599cdeb24f Mon Sep 17 00:00:00 2001 From: hustcer Date: Wed, 7 May 2025 08:13:48 +0800 Subject: [PATCH 12/15] Disable MSIUSEREALADMINDETECTION [ci skip] --- wix/main.wxs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wix/main.wxs b/wix/main.wxs index 88657b00f1..64dcce7be7 100644 --- a/wix/main.wxs +++ b/wix/main.wxs @@ -36,7 +36,7 @@ - + From 985210eb15ff12897771d1b175ee73157f758fa2 Mon Sep 17 00:00:00 2001 From: hustcer Date: Wed, 7 May 2025 19:14:10 +0800 Subject: [PATCH 13/15] chore: Add README.txt --- wix/main.wixproj | 1 + wix/main.wxs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/wix/main.wixproj b/wix/main.wixproj index 77e48b12e7..f89c73b8a7 100644 --- a/wix/main.wixproj +++ b/wix/main.wixproj @@ -28,6 +28,7 @@ + diff --git a/wix/main.wxs b/wix/main.wxs index 64dcce7be7..892182fa54 100644 --- a/wix/main.wxs +++ b/wix/main.wxs @@ -107,6 +107,9 @@ + + + From 9813ecbb661f484045a084c95c41588026104ffa Mon Sep 17 00:00:00 2001 From: hustcer Date: Wed, 7 May 2025 19:55:10 +0800 Subject: [PATCH 14/15] chore: Add ARPPRODUCTICON and ARPHELPLINK property --- wix/main.wxs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wix/main.wxs b/wix/main.wxs index 892182fa54..257ee4c620 100644 --- a/wix/main.wxs +++ b/wix/main.wxs @@ -38,6 +38,8 @@ + + From ce92cb381fe8b0c7a45edcce5f31310f86396d95 Mon Sep 17 00:00:00 2001 From: hustcer Date: Wed, 7 May 2025 21:06:34 +0800 Subject: [PATCH 15/15] Fix Wix4UtilCA BinaryRef and README.txt --- .github/workflows/release-pkg.nu | 1 + wix/main.wixproj | 2 +- wix/main.wxs | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release-pkg.nu b/.github/workflows/release-pkg.nu index a869bbbb62..af9fa5747c 100755 --- a/.github/workflows/release-pkg.nu +++ b/.github/workflows/release-pkg.nu @@ -200,6 +200,7 @@ if $os in ['macos-latest'] or $USE_UBUNTU { cd $src; cd wix; hr-line; mkdir nu # Wix need the binaries be stored in nu folder cp -r ($'($dist)/*' | into glob) nu/ + cp $'($dist)/README.txt' . ls -f nu/* | print let arch = if $nu.os-info.arch =~ 'x86_64' { 'x64' } else { 'arm64' } ./nu/nu.exe -c $'NU_RELEASE_VERSION=($version) dotnet build -c Release -p:Platform=($arch)' diff --git a/wix/main.wixproj b/wix/main.wixproj index f89c73b8a7..ccf018e0bd 100644 --- a/wix/main.wixproj +++ b/wix/main.wixproj @@ -4,7 +4,7 @@ nu-$(Platform) 82D756D2-19FA-4F09-B10F-64942E89F364 - SourceDir=$(MSBuildProjectDirectory)\nu + SourceDir=$(MSBuildProjectDirectory)\nu; true ICE80 diff --git a/wix/main.wxs b/wix/main.wxs index 257ee4c620..ee43ac4a1a 100644 --- a/wix/main.wxs +++ b/wix/main.wxs @@ -39,7 +39,7 @@ - + @@ -224,11 +224,11 @@ Impersonate="yes" Execute="deferred" DllEntry="WixQuietExec" - BinaryRef="Wix4UtilCA_X64" /> + BinaryRef="Wix4UtilCA_$(sys.BUILDARCHSHORT)" /> + Condition="(&WindowsTerminalProfile=3) OR ((!WindowsTerminalProfile=3) AND (REINSTALL<>""))" />