mirror of
https://github.com/netchx/netch.git
synced 2026-03-14 17:43:18 +08:00
[GitHub CI] Update build.yml
This commit is contained in:
31
.github/workflows/build.yml
vendored
31
.github/workflows/build.yml
vendored
@@ -11,34 +11,41 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Checksum
|
||||
- name: Checksum Other
|
||||
shell: pwsh
|
||||
run: |
|
||||
$otherHash=$(.\Other\sha256.ps1)
|
||||
$redirHash=$(.\Redirector\sha256.ps1)
|
||||
$routeHash=$(.\RouteHelper\sha256.ps1)
|
||||
echo "OTHER_SHA256=$(.\Other\sha256.ps1)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
||||
|
||||
echo "OTHER_SHA256=$otherHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
||||
echo "REDIR_SHA256=$redirHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
||||
echo "ROUTE_SHA256=$routeHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
||||
- name: Checksum Redirector
|
||||
shell: pwsh
|
||||
run: |
|
||||
echo "REDIRECTOR_SHA256=$(.\sha256.ps1 .\Redirector)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
||||
|
||||
- name: Checksum RouteHelper
|
||||
shell: pwsh
|
||||
run: |
|
||||
echo "ROUTEHELPER_SHA256=$(.\sha256.ps1 .\RouteHelper)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
||||
|
||||
- name: Cache Other
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
key: Netch-${{ runner.os }}-Other-${{ env.OTHER_SHA256 }}
|
||||
path: .\other\release
|
||||
path: |
|
||||
.\Other\release
|
||||
|
||||
- name: Cache Redirector
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
key: Netch-${{ runner.os }}-Redirector-${{ env.REDIR_SHA256 }}
|
||||
path: .\Redirector\bin
|
||||
key: Netch-${{ runner.os }}-Redirector-${{ env.REDIRECTOR_SHA256 }}
|
||||
path: |
|
||||
.\Redirector\bin
|
||||
|
||||
- name: Cache RouteHelper
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
key: Netch-${{ runner.os }}-RouteHelper-${{ env.ROUTE_SHA256 }}
|
||||
path: .\RouteHelper\bin
|
||||
key: Netch-${{ runner.os }}-RouteHelper-${{ env.ROUTEHELPER_SHA256 }}
|
||||
path: |
|
||||
.\RouteHelper\bin
|
||||
|
||||
- name: Check Other
|
||||
id: check_other
|
||||
|
||||
31
.github/workflows/release.yml
vendored
31
.github/workflows/release.yml
vendored
@@ -14,34 +14,41 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Checksum
|
||||
- name: Checksum Other
|
||||
shell: pwsh
|
||||
run: |
|
||||
$otherHash=$(.\Other\sha256.ps1)
|
||||
$redirHash=$(.\Redirector\sha256.ps1)
|
||||
$routeHash=$(.\RouteHelper\sha256.ps1)
|
||||
echo "OTHER_SHA256=$(.\Other\sha256.ps1)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
||||
|
||||
echo "OTHER_SHA256=$otherHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
||||
echo "REDIR_SHA256=$redirHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
||||
echo "ROUTE_SHA256=$routeHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
||||
- name: Checksum Redirector
|
||||
shell: pwsh
|
||||
run: |
|
||||
echo "REDIRECTOR_SHA256=$(.\sha256.ps1 .\Redirector)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
||||
|
||||
- name: Checksum RouteHelper
|
||||
shell: pwsh
|
||||
run: |
|
||||
echo "ROUTEHELPER_SHA256=$(.\sha256.ps1 .\RouteHelper)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
||||
|
||||
- name: Cache Other
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
key: Netch-${{ runner.os }}-Other-${{ env.OTHER_SHA256 }}
|
||||
path: .\Other\release
|
||||
path: |
|
||||
.\Other\release
|
||||
|
||||
- name: Cache Redirector
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
key: Netch-${{ runner.os }}-Redirector-${{ env.REDIR_SHA256 }}
|
||||
path: .\Redirector\bin
|
||||
key: Netch-${{ runner.os }}-Redirector-${{ env.REDIRECTOR_SHA256 }}
|
||||
path: |
|
||||
.\Redirector\bin
|
||||
|
||||
- name: Cache RouteHelper
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
key: Netch-${{ runner.os }}-RouteHelper-${{ env.ROUTE_SHA256 }}
|
||||
path: .\RouteHelper\bin
|
||||
key: Netch-${{ runner.os }}-RouteHelper-${{ env.ROUTEHELPER_SHA256 }}
|
||||
path: |
|
||||
.\RouteHelper\bin
|
||||
|
||||
- name: Check Other
|
||||
id: check_other
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)
|
||||
|
||||
$ms = [System.IO.MemoryStream]::new();
|
||||
$wr = [System.IO.StreamWriter]::new($ms);
|
||||
Get-ChildItem -Path '.' -File | ForEach-Object {
|
||||
$name=$_.Name
|
||||
|
||||
$wr.Write((Get-FileHash -Path ".\$name" -Algorithm SHA256).Hash.ToLower())
|
||||
}
|
||||
$ms.Position = 0
|
||||
|
||||
Write-Output (Get-FileHash -InputStream $ms).Hash.ToLower()
|
||||
Pop-Location
|
||||
@@ -1,13 +0,0 @@
|
||||
Push-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)
|
||||
|
||||
$ms = [System.IO.MemoryStream]::new();
|
||||
$wr = [System.IO.StreamWriter]::new($ms);
|
||||
Get-ChildItem -Path '.' -File | ForEach-Object {
|
||||
$name=$_.Name
|
||||
|
||||
$wr.Write((Get-FileHash -Path ".\$name" -Algorithm SHA256).Hash.ToLower())
|
||||
}
|
||||
$ms.Position = 0
|
||||
|
||||
Write-Output (Get-FileHash -InputStream $ms).Hash.ToLower()
|
||||
Pop-Location
|
||||
35
sha256.ps1
Normal file
35
sha256.ps1
Normal file
@@ -0,0 +1,35 @@
|
||||
param (
|
||||
[string]
|
||||
$Location = ''
|
||||
)
|
||||
|
||||
Push-Location $Location
|
||||
|
||||
$ms = [System.IO.MemoryStream]::new();
|
||||
$wr = [System.IO.StreamWriter]::new($ms);
|
||||
|
||||
function Scan {
|
||||
param (
|
||||
[string]
|
||||
$path = ''
|
||||
)
|
||||
|
||||
foreach ( $item in ( Get-ChildItem -Path $path ) ) {
|
||||
$name = $item.Name
|
||||
|
||||
if ( Test-Path -Path ".\$path\$name" -PathType Container ) {
|
||||
Scan -Path ".\$path\$name"
|
||||
continue
|
||||
}
|
||||
|
||||
if ( Test-Path -Path ".\$path\$name" -PathType Leaf ) {
|
||||
$wr.Write((Get-FileHash -Path ".\$path\$name" -Algorithm SHA256).Hash.ToLower())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Scan -Path '.'
|
||||
Write-Output (Get-FileHash -InputStream $ms).Hash.ToLower()
|
||||
|
||||
Pop-Location
|
||||
exit 0
|
||||
Reference in New Issue
Block a user