From 3ec5f2b589da0bf178f1efd313d58b294eb4907e Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Fri, 22 Sep 2023 14:04:02 +0200 Subject: [PATCH] add logic with generation hash --- .github/workflows/build-python-packages.yml | 17 +++++++++++++++-- helpers | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-python-packages.yml b/.github/workflows/build-python-packages.yml index 6b6ef3a9..a57d794e 100644 --- a/.github/workflows/build-python-packages.yml +++ b/.github/workflows/build-python-packages.yml @@ -183,6 +183,18 @@ jobs: body: | Python ${{ env.VERSION }} + - name: Generate hash for packages + run: | + $childItems = Get-Childitem -Path '.' + $childItems | Foreach-Object { + $packageObj = Get-Childitem -Path $_.FullName | Select-Object -First 1 + Write-Host "Package: $($packageObj.Name)" + $actualHash = (Get-FileHash -Path $packageObj.FullName -Algorithm sha256).Hash + $hashString = "$actualHash $($packageObj.Name)" + Write-Host "$hashString" + Add-Content -Path ./hashes.sha256 -Value "$hashString" + } + - name: Upload release assets uses: actions/github-script@v6 with: @@ -190,14 +202,15 @@ jobs: script: | const fs = require('fs'); for (let artifactDir of fs.readdirSync('.')) { - let artifactName = fs.readdirSync(`${artifactDir}`)[0]; + let artifactName = fs.lstatSync(artifactDir).isDirectory() ? fs.readdirSync(`${artifactDir}`)[0] : artifactDir; + console.log(`Upload ${artifactName} asset`); github.rest.repos.uploadReleaseAsset({ owner: context.repo.owner, repo: context.repo.repo, release_id: ${{ steps.create_release.outputs.id }}, name: artifactName, - data: fs.readFileSync(`./${artifactDir}/${artifactName}`) + data: fs.lstatSync(artifactDir).isDirectory() ? fs.readFileSync(`./${artifactDir}/${artifactName}`) : fs.readFileSync(`./${artifactName}`).toString() }); } diff --git a/helpers b/helpers index 896369fc..6fbb1f0f 160000 --- a/helpers +++ b/helpers @@ -1 +1 @@ -Subproject commit 896369fc7db1c89563d9a164d1ffc7f32d6c1c63 +Subproject commit 6fbb1f0f2098254142702dba05fe75cd8e77c4ae