forked from ScoopInstaller/Validator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change license
- Loading branch information
Showing
8 changed files
with
754 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
on: | ||
push: | ||
workflow_dispatch: | ||
pull_request: | ||
name: CI | ||
jobs: | ||
CI: | ||
name: CI | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@main | ||
- name: Build | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}' | ||
run: | | ||
& '.\install.ps1' | ||
& '.\build.ps1' | ||
- name: Upload Release Asset | ||
if: startsWith(github.ref, 'refs/tags/') | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
$tag = ($env:GITHUB_REF -split '/')[-1] | ||
$hubArgs = @() | ||
Get-ChildItem 'dist/*' | ForEach-Object { | ||
$hubArgs += '-a' | ||
$hubArgs += "$($_.FullName)" | ||
} | ||
$hubArgs = $hubArgs + @('--draft', "-m ""$tag""", """$tag""") | ||
hub release create @hubArgs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
packages/ | ||
build/ | ||
dist/ | ||
/packages/ | ||
/build/ | ||
/dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,52 @@ | ||
Push-Location $PSScriptRoot | ||
|
||
# Prepare | ||
$csc = "$PSScriptRoot\packages\Microsoft.Net.Compilers\tools\csc.exe" | ||
$build = "$PSScriptRoot\build" | ||
$dist = "$PSScriptRoot\dist" | ||
$src = "$PSScriptRoot\src" | ||
New-Item -ItemType Directory -Path $build -ErrorAction SilentlyContinue | Out-Null | ||
New-Item -ItemType Directory -Path $dist -ErrorAction SilentlyContinue | Out-Null | ||
Remove-Item "$build\*" -Recurse -Force | Out-Null | ||
Remove-Item "$dist\*" -Recurse -Force | Out-Null | ||
New-Item -Path $build, $dist -ItemType 'Directory' -ErrorAction 'SilentlyContinue' | Out-Null | ||
Remove-Item "$build\*", "$dist\*" -Recurse -Force | ||
|
||
if ((Get-ChildItem "$PSScriptRoot\packages" -Recurse).Count -eq 0) { | ||
Write-Host 'Dependencies are missing. Run ''install.ps1''' -ForegroundColor 'DarkRed' | ||
exit 258 | ||
} | ||
|
||
# Build | ||
Copy-Item "$PSScriptRoot\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll" $build | ||
Copy-Item "$PSScriptRoot\packages\Newtonsoft.Json.Schema\lib\net45\Newtonsoft.Json.Schema.dll" $build | ||
Copy-Item "$PSScriptRoot\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll", "$PSScriptRoot\packages\Newtonsoft.Json.Schema\lib\net45\Newtonsoft.Json.Schema.dll" $build | ||
|
||
Write-Output 'Compiling Scoop.Validator.cs ...' | ||
& "$PSScriptRoot\packages\Microsoft.Net.Compilers\tools\csc.exe" /deterministic /platform:anycpu /nologo /optimize /target:library /reference:"$build\Newtonsoft.Json.dll","$build\Newtonsoft.Json.Schema.dll" /out:"$build\Scoop.Validator.dll" "$src\Scoop.Validator.cs" | ||
Write-Output 'Compiling validator.cs ...' | ||
& "$PSScriptRoot\packages\Microsoft.Net.Compilers\tools\csc.exe" /deterministic /platform:anycpu /nologo /optimize /target:exe /reference:"$build\Scoop.Validator.dll","$build\Newtonsoft.Json.dll","$build\Newtonsoft.Json.Schema.dll" /out:"$build\validator.exe" "$src\validator.cs" | ||
$ScoopValidatorCs = @( | ||
'/deterministic' | ||
'/nologo' | ||
'/optimize' | ||
'/platform:anycpu' | ||
'/target:library' | ||
"/reference:""$build\Newtonsoft.Json.dll"",""$build\Newtonsoft.Json.Schema.dll""" | ||
"/out:""$build\Scoop.Validator.dll""" | ||
"$src\Scoop.Validator.cs" | ||
) | ||
& $csc @ScoopValidatorCs | ||
|
||
# Checksums | ||
Write-Output 'Computing checksums ...' | ||
Get-ChildItem "$build\*" -Include *.exe,*.dll -Recurse | ForEach-Object { | ||
$checksum = (Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash.ToLower() | ||
"$checksum *$($_.FullName.Replace($build, '').TrimStart('\'))" | Tee-Object -FilePath "$build\checksums.sha256" -Append | ||
} | ||
Write-Output 'Compiling validator.cs ...' | ||
$ValidatorCs = @( | ||
'/deterministic' | ||
'/nologo' | ||
'/optimize' | ||
'/platform:anycpu' | ||
'/target:exe' | ||
"/reference:""$build\Scoop.Validator.dll"",""$build\Newtonsoft.Json.dll"",""$build\Newtonsoft.Json.Schema.dll""" | ||
"/out:""$build\validator.exe""" | ||
"$src\validator.cs" | ||
) | ||
& $csc @ValidatorCs | ||
|
||
# Package | ||
7z a "$dist\validator.zip" "$build\*" | ||
Get-ChildItem "$dist\*" | ForEach-Object { | ||
$checksum = (Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash.ToLower() | ||
$checksum = (Get-FileHash -Path $_.FullName -Algorithm 'SHA256').Hash.ToLower() | ||
"$checksum *$($_.Name)" | Tee-Object -FilePath "$dist\$($_.Name).sha256" -Append | ||
} | ||
|
||
Pop-Location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
# https://github.com/edymtt/nugetstandalone | ||
$destinationFolder = "$psscriptroot\packages" | ||
if ((Test-Path -path $destinationFolder)) { | ||
Remove-Item -Path $destinationFolder -Recurse | Out-Null | ||
|
||
try { | ||
Get-Command -Name 'nuget' -Type 'Application' -ErrorAction 'Stop' | Out-Null | ||
} catch { | ||
Write-Host '''nuget'' not installed.' -ForegoundColor DarkRed | ||
exit 258 | ||
} | ||
|
||
New-Item $destinationFolder -Type Directory | Out-Null | ||
$destinationFolder = "$PSScriptRoot\packages" | ||
if (Test-Path $destinationFolder) { Remove-Item $destinationFolder -Recurse } | ||
New-Item $destinationFolder -Type 'Directory' | Out-Null | ||
|
||
nuget install packages.config -o $destinationFolder -ExcludeVersion |
This file was deleted.
Oops, something went wrong.