Parcourir la source

Added checksums calculation

alex.kopachov il y a 2 ans
Parent
commit
5b8fc6cdec
2 fichiers modifiés avec 12 ajouts et 3 suppressions
  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
       - uses: ncipollo/release-action@v1.12.0
         with:
         with:
-          artifacts: "build/*.fap"
+          artifacts: "build/*.fap,build/checksums.sha256"
           bodyFile: ".github/release-body.md"
           bodyFile: ".github/release-body.md"
           artifactErrorsFailBuild: true
           artifactErrorsFailBuild: true
           updateOnlyUnreleased: true
           updateOnlyUnreleased: true

+ 11 - 2
build.ps1

@@ -1,6 +1,7 @@
 param (
 param (
     [switch]$doNotBuildBaseFap = $false,
     [switch]$doNotBuildBaseFap = $false,
-    [switch]$buildCustomFontFap = $false
+    [switch]$buildCustomFontFap = $false,
+    [switch]$doNotClearBuildFolder = $false
 )
 )
 
 
 function Get-LatestDirectory {
 function Get-LatestDirectory {
@@ -36,7 +37,7 @@ Push-Location $PSScriptRoot
 
 
 if (!(Test-Path -PathType Container "build")) {
 if (!(Test-Path -PathType Container "build")) {
     New-Item -ItemType Directory -Path "build"
     New-Item -ItemType Directory -Path "build"
-} else {
+} elseif (!$doNotClearBuildFolder) {
     Remove-Item "build/*" -Recurse -Force
     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
 Pop-Location