11name : Upload release assets Mochi.PhysX test
2- on : [push, workflow_dispatch ]
2+ on : [release ]
33jobs :
44 publish-release-assets :
55 name : Publish Release Assets
66 runs-on : ubuntu-latest
77 # needs: build-mochi-physx
8- # if: github.event_name == 'release'
8+ if : github.event_name == 'release'
99 steps :
1010 # ----------------------------------------------------------------------- Download all artifacts
1111 - name : Download artifacts
@@ -22,11 +22,11 @@ jobs:
2222 script : |
2323 const fs = require('fs').promises;
2424 const path = require('path');
25- // const uploadUrl = context.payload.release.upload_url;
26- //
27- // if (!uploadUrl) {
28- // throw "Missing release asset upload URL!";
29- // }
25+ const uploadUrl = context.payload.release.upload_url;
26+
27+ if (!uploadUrl) {
28+ throw "Missing release asset upload URL!";
29+ }
3030
3131 async function uploadAssets(directoryPath) {
3232 for (let filePath of await fs.readdir(directoryPath)) {
@@ -40,15 +40,15 @@ jobs:
4040 }
4141
4242 console.log(`Uploading '${filePath}'`);
43- // await github.repos.uploadReleaseAsset({
44- // url: uploadUrl,
45- // headers: {
46- // 'content-type': 'application/octet-stream',
47- // 'content-length': stats.size
48- // },
49- // name: path.basename(filePath),
50- // data: await fs.readFile(filePath)
51- // });
43+ await github.repos.uploadReleaseAsset({
44+ url: uploadUrl,
45+ headers: {
46+ 'content-type': 'application/octet-stream',
47+ 'content-length': stats.size
48+ },
49+ name: path.basename(filePath),
50+ data: await fs.readFile(filePath)
51+ });
5252 }
5353 }
5454
0 commit comments