double check that the binaries were archived correctly
@@ -279,10 +279,21 @@ jobs:
- name: Pack binaries (Unix)
if: matrix.config.os != 'windows-latest'
run: |
+ set -e
+
archive=jormungandr-${{ needs.create_release.outputs.version }}-${{ matrix.config.target }}-${{ matrix.target_cpu }}.tar.gz
+
sha256sum ./target/${{ matrix.config.target }}/release/jormungandr | awk '{print $1}' > ./target/${{ matrix.config.target }}/release/jormungandr.sha256
sha256sum ./target/${{ matrix.config.target }}/release/jcli | awk '{print $1}' > ./target/${{ matrix.config.target }}/release/jcli.sha256
+
tar -C ./target/${{ matrix.config.target }}/release -czvf $archive jormungandr jormungandr.sha256 jcli jcli.sha256
+
+ mkdir ./archive-test
+ tar -C ./archive-test -xzvf $archive
+ echo "$(cat ./archive-test/jormungandr.sha256) ./archive-test/jormungandr" | sha256sum --check
+ echo "$(cat ./archive-test/jcli.sha256) ./archive-test/jcli" | sha256sum --check
+ rm -rf ./archive-test
+
cat <<EOF >> $GITHUB_ENV
RELEASE_ARCHIVE=$archive
RELEASE_CONTENT_TYPE=application/gzip
@@ -292,8 +303,10 @@ jobs:
if: matrix.config.os == 'windows-latest'
run: |
$archive = "jormungandr-${{ needs.create_release.outputs.version }}-${{ matrix.config.target }}-${{ matrix.target_cpu }}.zip"
- (Get-FileHash -Path "./target/${{ matrix.config.target }}/release/jormungandr.exe" -Algorithm SHA256).Hash | Out-File -FilePath "./jormungandr.exe.sha256"
- (Get-FileHash -Path "./target/${{ matrix.config.target }}/release/jcli.exe" -Algorithm SHA256).Hash | Out-File -FilePath ""./jcli.exe.sha256"
+
+ (Get-FileHash -Path "./target/${{ matrix.config.target }}/release/jormungandr.exe" -Algorithm SHA256).Hash.toLower() | Out-File -FilePath "./jormungandr.exe.sha256"
+ (Get-FileHash -Path "./target/${{ matrix.config.target }}/release/jcli.exe" -Algorithm SHA256).Hash.toLower() | Out-File -FilePath ""./jcli.exe.sha256"
+
$args = @{
Path = "./target/${{ matrix.config.target }}/release/jormungandr.exe",
"./jormungandr.exe.sha256",
@@ -302,6 +315,12 @@ jobs:
DestinationPath = $archive
}
Compress-Archive @args
+
+ Expand-Archive -Path $archive -DestinationPath "./archive-test"
+ if ((Get-FileHash -Path "./archive-test/jormungandr.exe" -Algorithm SHA256).Hash -ne (Get-Content -Path "./archive-test/jormungandr.exe.sha256")) { exit 1 }
+ if ((Get-FileHash -Path "./archive-test/jcli.exe" -Algorithm SHA256).Hash -eq (Get-Content -Path "./archive-test/jcli.exe.sha256")) { exit 1 }
+ Remove-Item -Recurse -Force -Path "./archive-test"
+
@"
RELEASE_ARCHIVE=$archive
RELEASE_CONTENT_TYPE=application/zip
