fix: install script on windows (#1168)

pull/1119/head
Hal Deadman 1 year ago committed by GitHub
parent 6a5b731e95
commit 68588b052d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      .github/workflows/test-install-osmatrix.yaml
  2. 13
      install.sh

@ -0,0 +1,30 @@
name: Test install.sh
on:
pull_request:
paths:
- 'install.sh'
push:
branches:
- 'main'
- 'pr-*'
jobs:
test-install-script:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Run install.sh on ${{ matrix.os }}
shell: bash
# just run install.sh b/c github can throttle itself based on egress limits and gets 503 sometimes
run: |
echo "Simulating: curl -s https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_REF_NAME/install.sh | bash"
./install.sh
k3d version
- name: Create cluster
if: matrix.os == 'ubuntu-latest' # mac and windows Github runners can't use docker
run: k3d cluster create demo

@ -27,7 +27,15 @@ initOS() {
case "$OS" in
# Minimalist GNU for Windows
mingw*) OS='windows';;
mingw*)
OS="windows"
USE_SUDO="false"
if [[ ! -d "$K3D_INSTALL_DIR" ]]; then
# mingw bash that ships with Git for Windows doesn't have /usr/local/bin but ~/bin is first entry in the path
mkdir -p ~/bin
K3D_INSTALL_DIR=~/bin
fi
;;
esac
}
@ -107,6 +115,9 @@ checkLatestVersion() {
downloadFile() {
K3D_DIST="k3d-$OS-$ARCH"
DOWNLOAD_URL="$REPO_URL/releases/download/$TAG/$K3D_DIST"
if [[ "$OS" == "windows" ]]; then
DOWNLOAD_URL=${DOWNLOAD_URL}.exe
fi
K3D_TMP_ROOT="$(mktemp -dt k3d-binary-XXXXXX)"
K3D_TMP_FILE="$K3D_TMP_ROOT/$K3D_DIST"
if type "curl" > /dev/null; then

Loading…
Cancel
Save