From ff4907ed3b7a2b96ba8d9929911691d74186f432 Mon Sep 17 00:00:00 2001 From: Justin Ma Date: Wed, 28 May 2025 21:03:01 +0800 Subject: [PATCH] Allow specifying MSI version via env var and workflow input (#15828) # Description This PR enhances the MSI release workflow by allowing the MSI package version to be specified either through an environment variable or a workflow input. This improvement provides greater flexibility when building MSI packages for tags that do **not** match the latest package version in `Cargo.toml`. Fix possible **403** error while updating `SHA256SUMS` file in the nushell/nightly repo # User-Facing Changes None # Tests + Formatting A example running record: https://github.com/nushell/nightly/actions/runs/15265879087/job/42931344366#step:5:11 --- .github/workflows/release-msi.nu | 6 ++++-- .github/workflows/release-msi.yml | 7 +++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-msi.nu b/.github/workflows/release-msi.nu index 2afac93662..df7bbb7f53 100755 --- a/.github/workflows/release-msi.nu +++ b/.github/workflows/release-msi.nu @@ -11,10 +11,12 @@ def build-msi [] { let target = $env.TARGET - let version = (open Cargo.toml | get package.version) + # We should read the version from the environment variable first + # As we may build the MSI package for a specific version not the latest one + let version = $env.MSI_VERSION? | default (open Cargo.toml | get package.version) let arch = if $nu.os-info.arch =~ 'x86_64' { 'x64' } else { 'arm64' } - print $'Building msi package for (ansi g)($target)(ansi reset) with version (ansi g)($env.REF)(ansi reset)' + print $'Building msi package for (ansi g)($target)(ansi reset) with version (ansi g)($version)(ansi reset) from tag (ansi g)($env.REF)(ansi reset)...' fetch-nu-pkg # Create extra Windows msi release package if dotnet and wix are available let installed = [dotnet wix] | all { (which $in | length) > 0 } diff --git a/.github/workflows/release-msi.yml b/.github/workflows/release-msi.yml index da1935decc..c70ce5c806 100644 --- a/.github/workflows/release-msi.yml +++ b/.github/workflows/release-msi.yml @@ -10,6 +10,12 @@ on: tag: required: true description: 'Tag to Rebuild MSI' + version: + description: 'Version of Rebuild MSI' + +permissions: + contents: write + packages: write defaults: run: @@ -61,6 +67,7 @@ jobs: OS: ${{ matrix.os }} REF: ${{ inputs.tag }} TARGET: ${{ matrix.target }} + MSI_VERSION: ${{ inputs.version }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # REF: https://github.com/marketplace/actions/gh-release