Updated the Installer and Docs

Updated Installer script and Docs accordingly to comments.
Now it does not request anymore the personal token to be produced.

Signed-off-by: alefesta <afesta@alfweb.com>
This commit is contained in:
alefesta 2021-06-30 17:54:12 +02:00
parent 40042204c5
commit 189fb715eb
2 changed files with 15 additions and 26 deletions

View File

@ -37,16 +37,10 @@ sudo mv ./bin/dagger /usr/local/bin
## Option 2 (Windows): Run a shell script ## Option 2 (Windows): Run a shell script
Since Dagger repository is currently private, we have to use a workaround
to be able to run the script and match the latest release.
This workaround will be removed once the repo will become public.
To generate a personal access token on GitHub follow the guidelines at [Create a personal access token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token)
From a terminal, run the following command: From a terminal, run the following command:
```shell ```shell
$personalToken= <INSERT YOUR PERSONAL TOKEN> curl https://releases.dagger.io/dagger/install.ps1 -OutFile install.ps1 ; ./install.ps1; rm install.ps1
curl https://releases.dagger.io/dagger/install.ps1 -OutFile install.ps1 ; ./install.ps1 -PersonalToken $personalToken; rm install.ps1
``` ```
We try to move the dagger binary under `C:\Windows\System32` but We try to move the dagger binary under `C:\Windows\System32` but

View File

@ -1,14 +1,12 @@
param ( # param (
[Parameter(Mandatory)] $PersonalToken # [Parameter(Mandatory)] $PersonalToken
) # )
Clear-Host Clear-Host
@" @"
--------------------------------------------------------------------------------- ---------------------------------------------------------------------------------
Author: Alessandro Festa Author: Alessandro Festa
Usage: To run using your GH personal developer token simply use the flag as below Dagger Installation Utility for Windows users
./install.ps1 -PersonalToken 1234567891213
Dagger executable will be save under the folder "dagger" in your home folder.
--------------------------------------------------------------------------------- ---------------------------------------------------------------------------------
"@ "@
@ -17,11 +15,14 @@ Dagger executable will be save under the folder "dagger" in your home folder.
$name="dagger" $name="dagger"
$base="https://dagger-io.s3.amazonaws.com" $base="https://dagger-io.s3.amazonaws.com"
function http_download { function http_download {
Clear-Host
$version=Get_Version $version=Get_Version
$version= $version -replace '[""]' $version=$version -replace '[""]'
$url = $base + "/" + $name + "/releases/" + $version.substring(1) + "/dagger_" + $version + "_windows_amd64.zip" $version=$version -replace '\n'
$fileName="dagger_" + $version + "_windows_amd64" $fileName="dagger_v" + $version + "_windows_amd64"
Clear-Host
$url = $base + "/" + $name + "/releases/" + $version + "/" + $fileName + ".zip"
write-host $url
Pause
Invoke-WebRequest -Uri $url -OutFile $env:temp/$fileName.zip -ErrorAction Stop Invoke-WebRequest -Uri $url -OutFile $env:temp/$fileName.zip -ErrorAction Stop
@ -52,13 +53,8 @@ Please add dagger.exe to your PATH in order to use it
} }
function Get_Version { function Get_Version {
$response = Invoke-RestMethod 'http://releases.dagger.io/dagger/latest_version' -Method 'GET' -Body $body -ErrorAction SilentlyContinue -ErrorVariable DownloadError
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", "token $PersonalToken")
$headers.Add("Accept", "application/vnd.github.VERSION.raw")
$response = Invoke-RestMethod 'https://api.github.com/repos/dagger/dagger/releases/latest' -Method 'GET' -Headers $headers -Body $body -ErrorAction SilentlyContinue -ErrorVariable DownloadError
If ($DownloadError) If ($DownloadError)
{ {
Clear-Host Clear-Host
@ -74,8 +70,7 @@ run the script and if it still fail please open an issue on the Dagger repo.
"@ "@
exit exit
} }
return $response
return $response.tag_name| ConvertTo-Json
} }