From e03b1131112a9080fb4709400bdccac245480f8f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 26 Feb 2023 21:26:53 +0000 Subject: [PATCH 1/5] build(deps): update rust crate schemars to 0.8.12 --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f25bd6b81..745786314 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2528,9 +2528,9 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a5fb6c61f29e723026dc8e923d94c694313212abbecbbe5f55a7748eec5b307" +checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" dependencies = [ "dyn-clone", "indexmap", @@ -2541,9 +2541,9 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f188d036977451159430f3b8dc82ec76364a42b7e289c2b18a9a18f4470058e9" +checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 2ab4adc0e..22a69b71f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -96,7 +96,7 @@ home = "0.5.4" shell-words = "1.1.0" [dependencies.schemars] -version = "0.8.11" +version = "0.8.12" optional = true features = ["preserve_order", "indexmap"] From fc531e75b051c363a79e0953b1089c36fa998962 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 20 Feb 2023 02:51:14 +0000 Subject: [PATCH 2/5] build(deps): update dprint plugins --- .dprint.json | 2 +- .github/workflows/format-workflow.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.dprint.json b/.dprint.json index cc1dd3313..533db334f 100644 --- a/.dprint.json +++ b/.dprint.json @@ -41,7 +41,7 @@ "target/" ], "plugins": [ - "https://github.com/dprint/dprint-plugin-typescript/releases/download/0.80.2/plugin.wasm", + "https://github.com/dprint/dprint-plugin-typescript/releases/download/0.83.0/plugin.wasm", "https://github.com/dprint/dprint-plugin-json/releases/download/0.17.0/plugin.wasm", "https://github.com/dprint/dprint-plugin-markdown/releases/download/0.15.2/plugin.wasm", "https://github.com/dprint/dprint-plugin-toml/releases/download/0.5.4/plugin.wasm" diff --git a/.github/workflows/format-workflow.yml b/.github/workflows/format-workflow.yml index 1ddf69752..852c95dc0 100644 --- a/.github/workflows/format-workflow.yml +++ b/.github/workflows/format-workflow.yml @@ -14,7 +14,7 @@ jobs: - name: Setup | Checkout uses: actions/checkout@v3 - name: Docs | Format - uses: dprint/check@v2.1 + uses: dprint/check@v2.2 # Validate preset files taplo: From 2f6b059b96bc340964993ff6ac4867d7ecda7437 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 27 Feb 2023 16:30:10 +0000 Subject: [PATCH 3/5] build(deps): update rust crate shadow-rs to 0.21.0 --- Cargo.lock | 4 ++-- Cargo.toml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 745786314..cc5ed4457 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2696,9 +2696,9 @@ dependencies = [ [[package]] name = "shadow-rs" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942b9991e2cfab3d5059e508d517c66bc460b302a2a8187a90d0aae4f08531d" +checksum = "427f07ab5f873000cf55324882e12a88c0a7ea7025df4fc1e7e35e688877a583" dependencies = [ "const_format", "is_debug", diff --git a/Cargo.toml b/Cargo.toml index 22a69b71f..f8196e3cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,7 +73,7 @@ semver = "1.0.16" serde = { version = "1.0.152", features = ["derive"] } serde_json = "1.0.93" sha1 = "0.10.5" -shadow-rs = { version = "0.20.1", default-features = false } +shadow-rs = { version = "0.21.0", default-features = false } # battery is optional (on by default) because the crate doesn't currently build for Termux # see: https://github.com/svartalf/rust-battery/issues/33 starship-battery = { version = "0.7.9", optional = true } @@ -117,7 +117,7 @@ features = [ nix = { version = "0.26.2", default-features = false, features = ["feature", "fs", "user"] } [build-dependencies] -shadow-rs = { version = "0.20.1", default-features = false } +shadow-rs = { version = "0.21.0", default-features = false } dunce = "1.0.3" [target.'cfg(windows)'.build-dependencies] From e51f25572a0d5559a662437a01cd629863386f1e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 27 Feb 2023 20:57:07 +0000 Subject: [PATCH 4/5] build(deps): update clap crates --- Cargo.lock | 12 ++++++------ Cargo.toml | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cc5ed4457..425bd0ee4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -283,9 +283,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.6" +version = "4.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0b0588d44d4d63a87dbd75c136c166bbfd9a86a31cb89e09906521c7d3f5e3" +checksum = "2f3061d6db6d8fcbbd4b05e057f2acace52e64e96b498c08c2d7a4e65addd340" dependencies = [ "bitflags", "clap_derive", @@ -300,18 +300,18 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.1.3" +version = "4.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0012995dc3a54314f4710f5631d74767e73c534b8757221708303e48eef7a19b" +checksum = "501ff0a401473ea1d4c3b125ff95506b62c5bc5768d818634195fbb7c4ad5ff4" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.1.0" +version = "4.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "684a277d672e91966334af371f1a7b5833f9aa00b07c84e92fbce95e00208ce8" +checksum = "34d122164198950ba84a918270a3bb3f7ededd25e15f7451673d986f55bd2667" dependencies = [ "heck 0.4.0", "proc-macro-error", diff --git a/Cargo.toml b/Cargo.toml index f8196e3cf..28fc60041 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,8 +43,8 @@ gix-faster = ["gix-features/zlib-stock", "gix/fast-sha1"] [dependencies] chrono = { version = "0.4.23", default-features = false, features = ["clock", "std", "wasmbind"] } -clap = { version = "4.1.6", features = ["derive", "cargo", "unicode"] } -clap_complete = "4.1.3" +clap = { version = "4.1.7", features = ["derive", "cargo", "unicode"] } +clap_complete = "4.1.4" dirs-next = "2.0.0" dunce = "1.0.3" gethostname = "0.4.1" From b55774d3a68b32c0ed17983adeb6355e75c65f6b Mon Sep 17 00:00:00 2001 From: David Knaack Date: Tue, 28 Feb 2023 06:03:32 +0100 Subject: [PATCH 5/5] feat(release): handle chocolatey starship.portable and starship.install pkg publishing (#4723) Handles starship.install (MSI installer) and starship.portable and makes starship an empty meta-package that only depends on starship.install. MSI/installer packages seem to be preferred over zip-based installers on chocolatey. Proper virtual packages that allow choosing either a portable or install variant aren't implemented in chocolatey yet. --- .github/workflows/workflow.yml | 10 ++- .../choco/chocolateyInstall.install.ps1 | 25 ++++++ .../choco/chocolateyInstall.portable.ps1 | 24 ++++++ install/windows/choco/chocolateyInstall.ps1 | 22 ----- install/windows/choco/starship.nuspec | 5 +- install/windows/choco/update.ps1 | 85 +++++++++++++------ 6 files changed, 120 insertions(+), 51 deletions(-) create mode 100644 install/windows/choco/chocolateyInstall.install.ps1 create mode 100644 install/windows/choco/chocolateyInstall.portable.ps1 delete mode 100644 install/windows/choco/chocolateyInstall.ps1 diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 0f27774f7..8894faba2 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -230,10 +230,12 @@ jobs: if: matrix.os == 'windows-latest' && matrix.rust == 'stable' run: | # Setup dummy release artifacts - New-Item -ItemType Directory -Path ./starship-x86_64-pc-windows-msvc - New-Item -ItemType Directory -Path ./starship-i686-pc-windows-msvc - New-Item -ItemType File -Path ./starship-x86_64-pc-windows-msvc/starship-x86_64-pc-windows-msvc.zip - New-Item -ItemType File -Path ./starship-i686-pc-windows-msvc/starship-i686-pc-windows-msvc.zip + foreach ($arch in @("aarch64", "i686", "x86_64")) { + foreach ($ext in @("zip", "msi")) { + New-Item -ItemType Directory -Path ./starship-$arch-pc-windows-msvc.$ext + New-Item -ItemType File -Path ./starship-$arch-pc-windows-msvc.$ext/starship-$arch-pc-windows-msvc.$ext + } + } # Build package pwsh ./install/windows/choco/update.ps1 env: diff --git a/install/windows/choco/chocolateyInstall.install.ps1 b/install/windows/choco/chocolateyInstall.install.ps1 new file mode 100644 index 000000000..01dfb775c --- /dev/null +++ b/install/windows/choco/chocolateyInstall.install.ps1 @@ -0,0 +1,25 @@ +$ErrorActionPreference = 'Stop' + +$packageName = $env:ChocolateyPackageName + +$url_x86_64_msi = '' +$url_i686_msi = '' +$checksum_x86_64_msi = '' +$checksum_i686_msi = '' + +$packageArgs = @{ + packageName = $packageName + fileType = 'msi' + url = $url_i686_msi + url64bit = $url_x86_64_msi + checksum = $checksum_i686_msi + checksum64 = $checksum_x86_64_msi + checksumType = 'sha256' + softwareName = 'starship*' + silentArgs = "/qn /norestart /l*v `"$($env:TEMP)\$($packageName).$($env:chocolateyPackageVersion).MsiInstall.log`"" + validExitCodes = @(0, 3010, 1641) +} +Install-ChocolateyPackage @packageArgs + +# Add to Profile +Write-Host "Add the following to the end of ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 'Invoke-Expression (&starship init powershell)'" diff --git a/install/windows/choco/chocolateyInstall.portable.ps1 b/install/windows/choco/chocolateyInstall.portable.ps1 new file mode 100644 index 000000000..21f0d9d5f --- /dev/null +++ b/install/windows/choco/chocolateyInstall.portable.ps1 @@ -0,0 +1,24 @@ +$ErrorActionPreference = 'Stop' + +$packageName = $env:ChocolateyPackageName + +$url_x86_64_zip = '' +$url_i686_zip = '' +$checksum_x86_64_zip = '' +$checksum_i686_zip = '' + +$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" +$packageArgs = @{ + packageName = $packageName + fileType = 'zip' + url = $url_i686_zip + url64bit = $url_x86_64_zip + checksum = $checksum_i686_zip + checksum64 = $checksum_x86_64_zip + checksumType = 'sha256' + unzipLocation = $toolsDir +} +Install-ChocolateyZipPackage @packageArgs + +# Add to Profile +Write-Host "Add the following to the end of ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 'Invoke-Expression (&starship init powershell)'" diff --git a/install/windows/choco/chocolateyInstall.ps1 b/install/windows/choco/chocolateyInstall.ps1 deleted file mode 100644 index a20e4deba..000000000 --- a/install/windows/choco/chocolateyInstall.ps1 +++ /dev/null @@ -1,22 +0,0 @@ -$ErrorActionPreference = 'Stop' - -$packageName = 'starship' - -$url_x86_64_zip = '' -$url_i686_zip = '' -$checksum_x86_64_zip = '' -$checksum_i686_zip = '' - -$checksumType = 'sha256' -$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" - -Install-ChocolateyZipPackage -PackageName "$packageName" ` - -Url "$url_i686_zip" ` - -Url64 "$url_x86_64_zip" ` - -UnzipLocation "$toolsDir" ` - -Checksum "$checksum_i686_zip" ` - -Checksum64 "$checksum_x86_64_zip" ` - -ChecksumType "$checksumType" - -# Add to Profile -Write-Host "Add the following to the end of ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 'Invoke-Expression (&starship init powershell)'" diff --git a/install/windows/choco/starship.nuspec b/install/windows/choco/starship.nuspec index ddbb26947..b9473cf84 100644 --- a/install/windows/choco/starship.nuspec +++ b/install/windows/choco/starship.nuspec @@ -16,10 +16,13 @@ https://github.com/starship/starship https://starship.rs/icon.png powershell prompt starship pwsh - © 2022 Starship Contributors + © 2023 Starship Contributors https://github.com/starship/starship/blob/master/LICENSE false + + + diff --git a/install/windows/choco/update.ps1 b/install/windows/choco/update.ps1 index 539228554..66c2862f2 100644 --- a/install/windows/choco/update.ps1 +++ b/install/windows/choco/update.ps1 @@ -17,40 +17,77 @@ $nuspec_file.package.metadata.version = $versionNumber $changelog = (Get-Content -Path ./CHANGELOG.md | Out-String) $nuspec_file.package.metadata.releaseNotes = $changelog +# Create variant nuspec files +$nuspec_file.package.metadata.id = "starship.portable" +$nuspec_file.Save("./starship.portable.nuspec") + +$nuspec_file.package.metadata.id = "starship.install" +$nuspec_file.Save("./starship.install.nuspec") + +# Have metapackage depend on starship.install +$nuspec_file.package.metadata.id = "starship" +$dep = $nuspec_file.createelement("dependency") +$dep.SetAttribute("id", "starship.install") +$dep.SetAttribute("version", "[$versionNumber]") +$nuspec_file.package.metadata.dependencies.AppendChild($dep) $nuspec_file.Save("./starship.nuspec") $url_x86_64_zip = "https://github.com/starship/starship/releases/download/$version/starship-x86_64-pc-windows-msvc.zip" $url_i686_zip = "https://github.com/starship/starship/releases/download/$version/starship-i686-pc-windows-msvc.zip" +$url_x86_64_msi = "https://github.com/starship/starship/releases/download/$version/starship-x86_64-pc-windows-msvc.msi" +$url_i686_msi = "https://github.com/starship/starship/releases/download/$version/starship-i686-pc-windows-msvc.msi" -$checksum_x86_64_zip = Get-FileHash -Algorithm SHA256 -Path "./starship-x86_64-pc-windows-msvc/starship-x86_64-pc-windows-msvc.zip" | Select-Object -ExpandProperty Hash -$checksum_i686_zip = Get-FileHash -Algorithm SHA256 -Path "./starship-i686-pc-windows-msvc/starship-i686-pc-windows-msvc.zip" | Select-Object -ExpandProperty Hash +$checksum_x86_64_zip = Get-FileHash -Algorithm SHA256 -Path "./starship-x86_64-pc-windows-msvc.zip/starship-x86_64-pc-windows-msvc.zip" | Select-Object -ExpandProperty Hash +$checksum_i686_zip = Get-FileHash -Algorithm SHA256 -Path "./starship-i686-pc-windows-msvc.zip/starship-i686-pc-windows-msvc.zip" | Select-Object -ExpandProperty Hash +$checksum_x86_64_msi = Get-FileHash -Algorithm SHA256 -Path "./starship-x86_64-pc-windows-msvc.msi/starship-x86_64-pc-windows-msvc.msi" | Select-Object -ExpandProperty Hash +$checksum_i686_msi = Get-FileHash -Algorithm SHA256 -Path "./starship-i686-pc-windows-msvc.msi/starship-i686-pc-windows-msvc.msi" | Select-Object -ExpandProperty Hash -if (!(Test-Path "./tools")) { - New-Item -ItemType Directory -Path "./tools" +if (Test-Path "./tools") { + Remove-Item -Path "./tools" -Recurse -Force } +New-Item -ItemType Directory -Path "./tools" -Get-Content ./install/windows/choco/chocolateyInstall.ps1 | ForEach-Object { - if ($_ -match '^\$url_x86_64_zip = (.*)') { - "`$url_x86_64_zip = '$url_x86_64_zip'" - } - elseif ($_ -match '^\$url_i686_zip = (.*)') { - "`$url_i686_zip = '$url_i686_zip'" - } - elseif ($_ -match '^\$checksum_x86_64_zip = (.*)') { - "`$checksum_x86_64_zip = '$checksum_x86_64_zip'" - } - elseif ($_ -match '^\$checksum_i686_zip = (.*)') { - "`$checksum_i686_zip = '$checksum_i686_zip'" - } - else { - $_ - } -} | Set-Content ./tools/chocolateyInstall.ps1 - +# Pack the metapackage as-is without install script choco pack ./starship.nuspec -if ($null -ne $Env:PUSH_TOKEN) { - choco push starship.$versionNumber.nupkg --key $ENV:PUSH_TOKEN +foreach ($install_type in @('portable', 'install')) { + Get-Content ./install/windows/choco/chocolateyInstall.$install_type.ps1 | ForEach-Object { + if ($_ -match '^\$url_x86_64_zip = (.*)') { + "`$url_x86_64_zip = '$url_x86_64_zip'" + } + elseif ($_ -match '^\$url_i686_zip = (.*)') { + "`$url_i686_zip = '$url_i686_zip'" + } + elseif ($_ -match '^\$url_x86_64_msi = (.*)') { + "`$url_x86_64_msi = '$url_x86_64_msi'" + } + elseif ($_ -match '^\$url_i686_msi = (.*)') { + "`$url_i686_msi = '$url_i686_msi'" + } + elseif ($_ -match '^\$checksum_x86_64_zip = (.*)') { + "`$checksum_x86_64_zip = '$checksum_x86_64_zip'" + } + elseif ($_ -match '^\$checksum_i686_zip = (.*)') { + "`$checksum_i686_zip = '$checksum_i686_zip'" + } + elseif ($_ -match '^\$checksum_x86_64_msi = (.*)') { + "`$checksum_x86_64_msi = '$checksum_x86_64_msi'" + } + elseif ($_ -match '^\$checksum_i686_msi = (.*)') { + "`$checksum_i686_msi = '$checksum_i686_msi'" + } + else { + $_ + } + } | Set-Content ./tools/chocolateyInstall.ps1 + + choco pack ./starship.$install_type.nuspec +} + +if ($null -ne $ENV:PUSH_TOKEN) { + choco push starship.portable.$versionNumber.nupkg --key $ENV:PUSH_TOKEN + choco push starship.install.$versionNumber.nupkg --key $ENV:PUSH_TOKEN + choco push starship.$versionNumber.nupkg --key $ENV:PUSH_TOKEN } else { Write-Host "No API key provided, skipping push"