Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update release instructions for Windows #60

Open
Irev-Dev opened this issue Jun 6, 2022 · 2 comments
Open

Update release instructions for Windows #60

Irev-Dev opened this issue Jun 6, 2022 · 2 comments

Comments

@Irev-Dev
Copy link
Contributor

Irev-Dev commented Jun 6, 2022

In the releases there are install instructions for various platforms, but the windows instructions are wrong as they use linux paths e.g.

windows/amd64

# Export the sha256sum for verification.
$ export KITTYCAD_CLI_SHA256="ee4a911b6814262b4e4d83c877654715a6442d401dbd2a104ebf31e82101e024"


# Download and check the sha256sum.
$ curl -fSL "https://dl.kittycad.io/releases/cli/v0.0.9/cli-windows-amd64" -o "/usr/local/bin/kittycad" \
	&& echo "${KITTYCAD_CLI_SHA256}  /usr/local/bin/kittycad" | sha256sum -c - \
	&& chmod a+x "/usr/local/bin/kittycad"


$ echo "kittycad cli installed!"

# Run it!
$ kittycad -h

Changes probably need to be made to cli/basic.mk

Looking at our cli install action might help as it works with a Windows runner, though it still uses bash, perhaps instructions should use powershell. Also adding the cli to %PATH% would be different outside of a github action runner.

@r-barton
Copy link

This is a first pass at one off powershell script. I'm still not sure how it fits into the rest of the release process but wanted to at least documented what I had. There is still a shortcoming where the enviroment path will be duplicated if this script is run multiple times, but the bones are there. cc'ing @jessfraz for awareness since she pointed this out to me on slack.

# Export the sha256sum for verification.
$ZOO_CLI_SHA256 = "0b5a2c6c35ecaee5e8e993d6f6192a2d4452b748fa8fc90b34e519c4e56f3b31"

# Define the local save path
$zoo_path = Join-Path $env:LOCALAPPDATA "Zoo"
$cli_path = Join-Path $zoo_path "zoo.exe"

# Create the directory for the zoo cli
New-Item -ItemType Directory -Force -Path $zoo_path | Out-Null

# Download
Invoke-WebRequest -Uri "https://dl.zoo.dev/releases/cli/v0.2.50/zoo-x86_64-pc-windows-gnu" -OutFile $cli_path

# Check the sha256sum.
(Get-FileHash $cli_path).Hash -eq $ZOO_CLI_SHA256

# Add the path to the zoo folder to "Path" env variable
[Environment]::SetEnvironmentVariable(
	"Path", 
	[Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine) + $zoo_path, 
	[EnvironmentVariableTarget]::Machine)
	
# Reload "Path" environment variable
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") 

# Run it!
& "zoo" "-h"

@r-barton
Copy link

r-barton commented Jun 7, 2024

Here's an updated version that includes a check with system env variables so that paths don't become duplicated

# Export the sha256sum for verification.
$ZOO_CLI_SHA256 = "0b5a2c6c35ecaee5e8e993d6f6192a2d4452b748fa8fc90b34e519c4e56f3b31"

# Define the local save path
$zoo_path = Join-Path $env:LOCALAPPDATA "Zoo"
$cli_path = Join-Path $zoo_path "zoo.exe"

# Create the directory for the zoo cli
New-Item -ItemType Directory -Force -Path $zoo_path | Out-Null

# Download
Invoke-WebRequest -Uri "https://dl.zoo.dev/releases/cli/v0.2.50/zoo-x86_64-pc-windows-gnu" -OutFile $cli_path

# Check the sha256sum.
Write-Host "Checksums match: " ((Get-FileHash $cli_path).Hash -eq $ZOO_CLI_SHA256)

# Function to check if a directory exists in the "Path" environment variable
function inPath($directory) {
    return ($Env:Path -split ';').TrimEnd('\') -contains $directory.TrimEnd('\')
}

# Add the path to the zoo folder to "Path" env variable if it doesn't exist
if ( !(inPath $zoo_path) ){
	[Environment]::SetEnvironmentVariable(
		"Path", 
		[Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine) + $zoo_path, 
		[EnvironmentVariableTarget]::Machine)
}
# Reload "Path" environment variable
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User") 

# Run it!
& "zoo" "-h"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants