Przeglądaj źródła

Added checksums calculation

alex.kopachov 2 lat temu
rodzic
commit
5b8fc6cdec
2 zmienionych plików z 12 dodań i 3 usunięć
  1. 1 1
      .github/workflows/create-new-release.yml
  2. 11 2
      build.ps1

+ 1 - 1
.github/workflows/create-new-release.yml

@@ -56,7 +56,7 @@ jobs:
 
       - uses: ncipollo/release-action@v1.12.0
         with:
-          artifacts: "build/*.fap"
+          artifacts: "build/*.fap,build/checksums.sha256"
           bodyFile: ".github/release-body.md"
           artifactErrorsFailBuild: true
           updateOnlyUnreleased: true

+ 11 - 2
build.ps1

@@ -1,6 +1,7 @@
 param (
     [switch]$doNotBuildBaseFap = $false,
-    [switch]$buildCustomFontFap = $false
+    [switch]$buildCustomFontFap = $false,
+    [switch]$doNotClearBuildFolder = $false
 )
 
 function Get-LatestDirectory {
@@ -36,7 +37,7 @@ Push-Location $PSScriptRoot
 
 if (!(Test-Path -PathType Container "build")) {
     New-Item -ItemType Directory -Path "build"
-} else {
+} elseif (!$doNotClearBuildFolder) {
     Remove-Item "build/*" -Recurse -Force
 }
 
@@ -141,4 +142,12 @@ if ($buildCustomFontFap -eq $true) {
     }
 }
 
+$checksum_file = 'build/checksums.sha256'
+New-Item $checksum_file -ItemType File -Force
+Get-ChildItem -Path 'build/*.fap' | ForEach-Object {
+    $checksum = (Get-FileHash $_ -Algorithm SHA256).Hash.ToLower()
+    $filename = $_.Name
+    "$checksum  $filename" >> $checksum_file
+}
+
 Pop-Location