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:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: Checksum
|
- name: Checksum Other
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
$otherHash=$(.\Other\sha256.ps1)
|
echo "OTHER_SHA256=$(.\Other\sha256.ps1)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
||||||
$redirHash=$(.\Redirector\sha256.ps1)
|
|
||||||
$routeHash=$(.\RouteHelper\sha256.ps1)
|
|
||||||
|
|
||||||
echo "OTHER_SHA256=$otherHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
- name: Checksum Redirector
|
||||||
echo "REDIR_SHA256=$redirHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
shell: pwsh
|
||||||
echo "ROUTE_SHA256=$routeHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
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
|
- name: Cache Other
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
key: Netch-${{ runner.os }}-Other-${{ env.OTHER_SHA256 }}
|
key: Netch-${{ runner.os }}-Other-${{ env.OTHER_SHA256 }}
|
||||||
path: .\other\release
|
path: |
|
||||||
|
.\Other\release
|
||||||
|
|
||||||
- name: Cache Redirector
|
- name: Cache Redirector
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
key: Netch-${{ runner.os }}-Redirector-${{ env.REDIR_SHA256 }}
|
key: Netch-${{ runner.os }}-Redirector-${{ env.REDIRECTOR_SHA256 }}
|
||||||
path: .\Redirector\bin
|
path: |
|
||||||
|
.\Redirector\bin
|
||||||
|
|
||||||
- name: Cache RouteHelper
|
- name: Cache RouteHelper
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
key: Netch-${{ runner.os }}-RouteHelper-${{ env.ROUTE_SHA256 }}
|
key: Netch-${{ runner.os }}-RouteHelper-${{ env.ROUTEHELPER_SHA256 }}
|
||||||
path: .\RouteHelper\bin
|
path: |
|
||||||
|
.\RouteHelper\bin
|
||||||
|
|
||||||
- name: Check Other
|
- name: Check Other
|
||||||
id: check_other
|
id: check_other
|
||||||
|
|||||||
31
.github/workflows/release.yml
vendored
31
.github/workflows/release.yml
vendored
@@ -14,34 +14,41 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: Checksum
|
- name: Checksum Other
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
$otherHash=$(.\Other\sha256.ps1)
|
echo "OTHER_SHA256=$(.\Other\sha256.ps1)" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
||||||
$redirHash=$(.\Redirector\sha256.ps1)
|
|
||||||
$routeHash=$(.\RouteHelper\sha256.ps1)
|
|
||||||
|
|
||||||
echo "OTHER_SHA256=$otherHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
- name: Checksum Redirector
|
||||||
echo "REDIR_SHA256=$redirHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
shell: pwsh
|
||||||
echo "ROUTE_SHA256=$routeHash" | Out-File -Append -Encoding UTF8 -FilePath $Env:GITHUB_ENV
|
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
|
- name: Cache Other
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
key: Netch-${{ runner.os }}-Other-${{ env.OTHER_SHA256 }}
|
key: Netch-${{ runner.os }}-Other-${{ env.OTHER_SHA256 }}
|
||||||
path: .\Other\release
|
path: |
|
||||||
|
.\Other\release
|
||||||
|
|
||||||
- name: Cache Redirector
|
- name: Cache Redirector
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
key: Netch-${{ runner.os }}-Redirector-${{ env.REDIR_SHA256 }}
|
key: Netch-${{ runner.os }}-Redirector-${{ env.REDIRECTOR_SHA256 }}
|
||||||
path: .\Redirector\bin
|
path: |
|
||||||
|
.\Redirector\bin
|
||||||
|
|
||||||
- name: Cache RouteHelper
|
- name: Cache RouteHelper
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
key: Netch-${{ runner.os }}-RouteHelper-${{ env.ROUTE_SHA256 }}
|
key: Netch-${{ runner.os }}-RouteHelper-${{ env.ROUTEHELPER_SHA256 }}
|
||||||
path: .\RouteHelper\bin
|
path: |
|
||||||
|
.\RouteHelper\bin
|
||||||
|
|
||||||
- name: Check Other
|
- name: Check Other
|
||||||
id: 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