Skip to content

Commit 68e3c45

Browse files
committed
workflows: debos: Get links to pre-built artifacts
1 parent 06935e0 commit 68e3c45

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/debos.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,52 @@ jobs:
4444
with:
4545
fetch-depth: 0
4646

47+
- name: Download links to Linux deb and U-Boot for RB1
48+
uses: actions/github-script@v6
49+
with:
50+
script: |
51+
// this doesn't restrict to a particular workflow run, but the
52+
// artifacts we're looking for will only be built from a scheduled
53+
// (cron) run, and not from pull requests
54+
let allArtifacts =
55+
await github.rest.actions.listArtifacts({
56+
owner: context.repo.owner,
57+
repo: context.repo.repo,
58+
});
59+
// keep first artifact named u-boot-rb1-links and linux-deb-links
60+
let u_boot_rb1 = allArtifacts.data.artifacts.filter((artifact) => {
61+
return artifact.name == "u-boot-rb1-links"
62+
})[0];
63+
let linux_deb = allArtifacts.data.artifacts.filter((artifact) => {
64+
return artifact.name == "linux-deb-links"
65+
})[0];
66+
// download both in memory
67+
let linux_deb_dl =
68+
await github.rest.actions.downloadArtifact({
69+
owner: context.repo.owner,
70+
repo: context.repo.repo,
71+
artifact_id: linux_deb.id,
72+
archive_format: 'zip',
73+
});
74+
let u_boot_rb1_dl =
75+
await github.rest.actions.downloadArtifact({
76+
owner: context.repo.owner,
77+
repo: context.repo.repo,
78+
artifact_id: u_boot_rb1.id,
79+
archive_format: 'zip',
80+
});
81+
// write files under temp dir
82+
const fs = require('fs');
83+
const path = require('path');
84+
const temp = '${{ runner.temp }}/artifacts';
85+
if (!fs.existsSync(temp)){
86+
fs.mkdirSync(temp);
87+
}
88+
fs.writeFileSync(path.join(temp, 'linux_deb_links.zip'),
89+
Buffer.from(linux_deb_dl.data));
90+
fs.writeFileSync(path.join(temp, 'u_boot_rb1_links.zip'),
91+
Buffer.from(u_boot_rb1_dl.data));
92+
4793
# make sure we have latest packages first, to get latest fixes and to
4894
# avoid an automated update while we're building
4995
- name: Update OS packages

0 commit comments

Comments
 (0)