10000 fix: release assets upload · mayeut/python-versions@907e4d8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 907e4d8

Browse files
committed
fix: release assets upload
actions#267 introduced a regression in asset upload. The layout of the artefacts to upload has changed. They're now all flatten in the working directory whereas before that PR, only the `hashes.sha256` file was directly in the working directory. The change in layout caused `.toString()` to be called on python archives which corrupts the data that gets uploaded (as can be seen by comparing sha256 in `hashes.sha256` with the ones from other uploaded assets). This commit ensures that a "flat layout" is used and that `toString()` is only called for `hashes.sha256`.
1 parent cc396a6 commit 907e4d8

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

.github/workflows/build-python-packages.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,16 +212,18 @@ jobs:
212212
github-token: ${{ secrets.GITHUB_TOKEN }}
213213
script: |
214214
const fs = require('fs');
215-
for (let artifactDir of fs.readdirSync('.')) {
216-
let artifactName = fs.lstatSync(artifactDir).isDirectory() ? fs.readdirSync(`${artifactDir}`)[0] : artifactDir;
217-
215+
const assert = require('assert');
216+
for (let artifactName of fs.readdirSync('.')) {
217+
assert(fs.lstatSync(artifactName).isFile());
218218
console.log(`Upload ${artifactName} asset`);
219+
const isHashes = artifactName === 'hashes.sha256';
220+
const data = fs.readFileSync(artifactName);
219221
github.rest.repos.uploadReleaseAsset({
220222
owner: context.repo.owner,
221223
repo: context.repo.repo,
222224
release_id: ${{ steps.create_release.outputs.id }},
223225
name: artifactName,
224-
data: fs.lstatSync(artifactDir).isDirectory() ? fs.readFileSync(`./${artifactDir}/${artifactName}`) : fs.readFileSync(`./${artifactName}`).toString()
226+
data: isHashes ? data.toString() : data
225227
});
226228
}
227229

0 commit comments

Comments
 (0)
0