diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 92e815b..619b728 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ on: jobs: build: - name: Build wheels on ${{ matrix.os }} + name: Build binary on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: diff --git a/CHANGELOG.md b/CHANGELOG.md index 977a1c0..e0cc81e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.2.1 (2021-08-02) + +- Version 1.2.1 +- Fix powershell installer to get latest release tag dynamically +- Minor changes + ## 1.2.0 (2021-08-01) - Version 1.2.0 @@ -7,9 +13,9 @@ ## 1.1.1 (2021-06-04) - Version 1.1.1. -- Add [dotenv](https://docrunner-cli.web.app/docs/configuration#dotenv) +- Add [`dotenv`](https://docrunner-cli.web.app/docs/configuration#dotenv) as a configuration option in the `docrunner.toml` configuration file -- Added [docrunner self update](https://docrunner-cli.web.app/docs/getting-started#updating) command +- Added [`docrunner self update`](https://docrunner-cli.web.app/docs/getting-started#updating) command ## 1.1.0 (2021-06-03) diff --git a/README.md b/README.md index 1d60e2c..3d4344a 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ curl https://raw.githubusercontent.com/DudeBro249/docrunner/stable/installers/in Powershell (Windows): ```powershell -iwr -useb https://raw.githubusercontent.com/DudeBro249/docrunner/stable/installers/install.ps1 | iex +iwr -useb https://raw.githubusercontent.com/DudeBro249/docrunner/stable/installers/install-windows.ps1 | iex ``` If none of these methods work, you can also install the `docrunner` binary from diff --git a/installers/install.ps1 b/installers/install-windows.ps1 similarity index 56% rename from installers/install.ps1 rename to installers/install-windows.ps1 index 38cb381..f0141de 100644 --- a/installers/install.ps1 +++ b/installers/install-windows.ps1 @@ -7,17 +7,37 @@ $ErrorActionPreference = "Stop" # Defining path to docrunner executable in variable $DocrunnerDirectory = 'C:\src\Docrunner' +# Function to get the redirected url +Function Get-RedirectedUrl { + Param ( + [Parameter(Mandatory=$true)] + [String]$URL + ) + + $request = [System.Net.WebRequest]::Create($url) + $request.AllowAutoRedirect=$false + $response=$request.GetResponse() + + If ($response.StatusCode -eq "Found") + { + $response.GetResponseHeader("Location") + } +} + # Only create Docrunner directory if it does not already exist if (Test-Path -Path $DocrunnerDirectory) { - Write-Host "$DocrunnerDirectory already exists" - Write-Host "Not creating directory" + Write-Host "$DocrunnerDirectory already exists, no need to create directory" Write-Host "" } else { new-item $DocrunnerDirectory -itemtype directory } # Download docrunner.exe from github releases -Start-BitsTransfer 'https://github.com/DudeBro249/docrunner/releases/download/v1.1.1/docrunner.exe' "$DocrunnerDirectory\docrunner.exe" -Description 'Downloading Docrunner from https://github.com/DudeBro249/docrunner/releases' -DisplayName 'Downloading Docrunner' -TransferType Download +$LATEST_RELEASE_URL = Get-RedirectedUrl -URL 'https://github.com/DudeBro249/docrunner/releases/latest' +$LATEST_RELEASE_TAG = $LATEST_RELEASE_URL.Split("/")[7] +$DOCRUNNER_BINARY_URL = "https://github.com/DudeBro249/docrunner/releases/download/$LATEST_RELEASE_TAG/docrunner-windows.exe" + +Start-BitsTransfer $DOCRUNNER_BINARY_URL "$DocrunnerDirectory\docrunner.exe" -Description "Downloading Docrunner from $DOCRUNNER_BINARY_URL" -DisplayName 'Downloading Docrunner' -TransferType Download Write-Host 'Installing Docrunner' -ForegroundColor cyan @@ -31,8 +51,7 @@ if ($UserPath -ne $null) if ($UserPath -split ';' -contains $DocrunnerDirectory) { Write-Host "" - Write-Host "$DocrunnerDirectory already exists in PATH" - Write-Host "No need to add it" + Write-Host "$DocrunnerDirectory already exists in PATH, no need to add it" Write-Host "" } else diff --git a/lib/commands/self/update.dart b/lib/commands/self/update.dart index 596059c..34e3075 100644 --- a/lib/commands/self/update.dart +++ b/lib/commands/self/update.dart @@ -18,17 +18,20 @@ class UpdateCommand extends Command { var outputMessage = 'Copy and paste this command into your terminal: '; if (Platform.isWindows) { installationCommand = - 'iwr -useb https://raw.githubusercontent.com/DudeBro249/docrunner/stable/installers/install.ps1 | iex'; + 'iwr -useb https://raw.githubusercontent.com/DudeBro249/docrunner/stable/installers/install-windows.ps1 | iex'; outputMessage = 'Copy and paste this command into your powershell terminal'; - } else if (Platform.isMacOS || Platform.isLinux) { + } else if (Platform.isLinux) { installationCommand = - 'curl -fsSL https://raw.githubusercontent.com/DudeBro249/docrunner/stable/installers/install.sh | sh'; + 'curl https://raw.githubusercontent.com/DudeBro249/docrunner/stable/installers/install-linux.sh | sudo bash'; + } else if (Platform.isMacOS) { + installationCommand = + 'curl https://raw.githubusercontent.com/DudeBro249/docrunner/stable/installers/install-mac.sh | sudo bash'; } stdout.writeln( Colorize( - '$outputMessage\n', + '\n$outputMessage\n', ).green(), ); stdout.writeln('$installationCommand\n'); diff --git a/lib/constants/version.dart b/lib/constants/version.dart index 3822f4b..31d8ffd 100644 --- a/lib/constants/version.dart +++ b/lib/constants/version.dart @@ -1 +1 @@ -const version = '1.1.1'; +const version = '1.2.1'; diff --git a/pubspec.yaml b/pubspec.yaml index efbb551..9ff3911 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: docrunner description: A command line tool which allows you to run the code in your markdown files to ensure that readers always have access to working code. -version: 1.2.0 +version: 1.2.1 homepage: https://github.com/DudeBro249/docrunner environment: diff --git a/website/docs/getting-started.md b/website/docs/getting-started.md index 0c8cf72..a192e6d 100644 --- a/website/docs/getting-started.md +++ b/website/docs/getting-started.md @@ -15,7 +15,7 @@ curl https://raw.githubusercontent.com/DudeBro249/docrunner/stable/installers/in Powershell (Windows): ```powershell -iwr -useb https://raw.githubusercontent.com/DudeBro249/docrunner/stable/installers/install.ps1 | iex +iwr -useb https://raw.githubusercontent.com/DudeBro249/docrunner/stable/installers/install-windows.ps1 | iex ``` If none of these methods work, you can also install the `docrunner` binary from