Skip to content

Commit e07d3d7

Browse files
committed
workflows: debos: Get links to pre-built artifacts
1 parent a387dc3 commit e07d3d7

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/debos.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,51 @@ jobs:
5656
# recipe
5757
apt -y install debos mtools
5858
59+
- name: Download links to Linux deb and U-Boot for RB1
60+
uses: actions/github-script@v7
61+
with:
62+
script: |
63+
# get all artifacts for this workflow run
64+
let allArtifacts =
65+
await github.rest.actions.listWorkflowRunArtifacts({
66+
owner: context.repo.owner,
67+
repo: context.repo.repo,
68+
run_id: context.payload.workflow_run.id,
69+
});
70+
# keep first artifact named u-boot-rb1-links and linux-deb-links
71+
let u_boot_rb1 = allArtifacts.data.artifacts.filter((artifact) => {
72+
return artifact.name == "u-boot-rb1-links"
73+
})[0];
74+
let linux_deb = allArtifacts.data.artifacts.filter((artifact) => {
75+
return artifact.name == "linux-deb-links"
76+
})[0];
77+
# download both in memory
78+
let u_boot_rb1_dl =
79+
await github.rest.actions.downloadArtifact({
80+
owner: context.repo.owner,
81+
repo: context.repo.repo,
82+
artifact_id: u_boot_rb1.id,
83+
archive_format: 'zip',
84+
});
85+
let linux_deb_dl =
86+
await github.rest.actions.downloadArtifact({
87+
owner: context.repo.owner,
88+
repo: context.repo.repo,
89+
artifact_id: linux_deb.id,
90+
archive_format: 'zip',
91+
});
92+
# write files under temp dir
93+
const fs = require('fs');
94+
const path = require('path');
95+
const temp = '${{ runner.temp }}/artifacts';
96+
if (!fs.existsSync(temp)){
97+
fs.mkdirSync(temp);
98+
}
99+
fs.writeFileSync(path.join(temp, 'linux_deb_links.zip'),
100+
Buffer.from(linux_deb.data));
101+
fs.writeFileSync(path.join(temp, 'u_boot_rb1_links.zip'),
102+
Buffer.from(u_boot_rb1.data));
103+
59104
- name: Build debos recipe
60105
run: |
61106
set -x

0 commit comments

Comments
 (0)