diff --git a/.github/workflows/integration-install.yml b/.github/workflows/integration-install.yml index 665f8eb84..1a23c5d0b 100644 --- a/.github/workflows/integration-install.yml +++ b/.github/workflows/integration-install.yml @@ -5,17 +5,31 @@ on: jobs: install: - runs-on: ubuntu-latest + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 - - name: Run Install Script + - name: Run Install Script + shell: bash run: ./scripts/install.sh - name: Validate Command is Installed + shell: bash run: | - if ! command -v draft &> /dev/null + if command -v /home/runner/.local/bin/draft &> /dev/null then - echo "draft could not be found" - exit 1 + echo "install_dir=/home/runner/.local/bin/draft" >> $GITHUB_ENV + elif command -v /usr/local/bin/draft &> /dev/null + then + echo "install_dir=/usr/local/bin/draft" >> $GITHUB_ENV + elif command -v /c/Users/runneradmin/.local/bin/draft &> /dev/null + then + echo "install_dir=/c/Users/runneradmin/.local/bin/draft" >> $GITHUB_ENV + else + echo "draft could not be found" + exit 1 fi - name: Validate Draft Command Runs - run: draft -h \ No newline at end of file + shell: bash + run: ${{ env.install_dir }} -h \ No newline at end of file diff --git a/scripts/install.sh b/scripts/install.sh index 900d21776..8d8b914a1 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -106,7 +106,11 @@ check_jq_processor_present(){ # Download draft cli stable version. download_draft_cli_stable_version(){ - FILENAME="draft-$OS-$ARCH" + if [ "$OS" == "windows" ]; then + FILENAME="draft-$OS-$ARCH".exe + else + FILENAME="draft-$OS-$ARCH" + fi log INFO "Starting Draft CLI Download for $FILENAME" DRAFTCLIVERSION=$(curl -L -s https://api.github.com/repos/Azure/draft/releases/latest | jq -r '.tag_name') log INFO "Starting Draft CLI Version $DRAFTCLIVERSION" @@ -123,7 +127,7 @@ file_issue_prompt() { } copy_draft_files() { - if [[ ":$PATH:" == *":$HOME/.local/bin:"* ]]; then + if [[ ":$PATH:" == *":$HOME/.local/bin:"* || "$OS" == "windows" ]]; then if [ ! -d "$HOME/.local/bin" ]; then mkdir -p "$HOME/.local/bin" fi @@ -143,8 +147,8 @@ install() { OS="linux" elif [[ "$OSTYPE" == "darwin"* ]]; then OS="darwin" - elif [[ "$OSTYPE" == "win32" ]]; then - OS="win" + elif [[ "$OSTYPE" == "win32" || "$OSTYPE" == "msys" ]]; then + OS="windows" else echo "Draft CLI isn't supported for your platform - $OSTYPE" file_issue_prompt