Skip to content

Commit 5ebfd87

Browse files
committed
github: generate package_index json
1 parent 45d06f8 commit 5ebfd87

File tree

3 files changed

+114
-0
lines changed

3 files changed

+114
-0
lines changed

Diff for: .github/workflows/package_core.yml

+35
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,38 @@ jobs:
202202

203203
- name: Upload artifact
204204
run: aws s3 cp ${{ env.ARTIFACT_FILE }} s3://${{ secrets.S3_BUCKET }}/
205+
206+
publish-json:
207+
name: Publish json
208+
runs-on: ubuntu-latest
209+
if: ${{ github.event_name == 'push' && github.repository == 'arduino/ArduinoCore-zephyr' }}
210+
needs:
211+
- package-core
212+
- publish-core
213+
env:
214+
CORE_ARTIFACT: ${{ needs.package-core.outputs.CORE_ARTIFACT }}
215+
ARTIFACT_FILE: ${{ needs.package-core.outputs.CORE_ARTIFACT }}.tar.bz2
216+
CORE_TAG: ${{ needs.package-core.outputs.CORE_TAG }}
217+
PACKAGE_INDEX_JSON: zephyr-core-${{ needs.package-core.outputs.CORE_TAG }}.json
218+
steps:
219+
- uses: actions/checkout@v4
220+
with:
221+
fetch-depth: 0
222+
persist-credentials: false
223+
sparse-checkout: |
224+
extra/gen_package_index_json.sh
225+
extra/zephyr-core-template.json
226+
227+
- uses: actions/download-artifact@v4
228+
with:
229+
name: ${{ env.CORE_ARTIFACT }}
230+
231+
# uses: ARTIFACT_FILE CORE_TAG PACKAGE_INDEX_JSON
232+
- name: Prepare package index snippet
233+
run: ./extra/gen_package_index_json.sh
234+
235+
- name: Archive package index snippet
236+
uses: actions/upload-artifact@v4
237+
with:
238+
name: ${{ env.PACKAGE_INDEX_JSON }}
239+
path: ${{ env.PACKAGE_INDEX_JSON }}

Diff for: extra/gen_package_index_json.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
if [ -z "$CORE_TAG" ]; then
4+
echo "This script can be used in Github CI only."
5+
exit 1
6+
fi
7+
8+
cat extra/zephyr-core-template.json | sed \
9+
-e "s/__CORE_TAG__/$CORE_TAG/" \
10+
-e "s/__ARTIFACT_FILE__/$ARTIFACT_FILE/" \
11+
-e "s/__ARTIFACT_HASH__/$(sha256sum $ARTIFACT_FILE | awk '{print $1}')/" \
12+
-e "s/__ARTIFACT_SIZE__/$(stat -c %s $ARTIFACT_FILE)/" \
13+
> $PACKAGE_INDEX_JSON

Diff for: extra/zephyr-core-template.json

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"packages": [
3+
{
4+
"platforms": [
5+
{
6+
"name": "Arduino Zephyr Boards",
7+
"architecture": "zephyr",
8+
"version": "__CORE_TAG__",
9+
"category": "Arduino",
10+
"url": "https://downloads.arduino.cc/cores/zephyr/__ARTIFACT_FILE__",
11+
"archiveFileName": "__ARTIFACT_FILE__",
12+
"checksum": "SHA-256:__ARTIFACT_HASH__",
13+
"size": "__ARTIFACT_SIZE__",
14+
"help": {
15+
"online": "https://www.arduino.cc/en/Reference/HomePage"
16+
},
17+
"boards": [
18+
{
19+
"name": "Arduino Giga"
20+
},
21+
{
22+
"name": "Arduino Nano 33 BLE"
23+
},
24+
{
25+
"name": "Arduino Portenta H7"
26+
},
27+
{
28+
"name": "Arduino Portenta C33"
29+
},
30+
{
31+
"name": "Renesas EK_RA8D1"
32+
},
33+
{
34+
"name": "NXP FRDM MCXN947"
35+
},
36+
{
37+
"name": "NXP FRDM RW612"
38+
}
39+
],
40+
"toolsDependencies": [
41+
{
42+
"packager": "zephyr",
43+
"name": "arm-zephyr-eabi",
44+
"version": "0.16.8"
45+
},
46+
{
47+
"packager": "arduino",
48+
"name": "dfu-util",
49+
"version": "0.11.0-arduino5"
50+
},
51+
{
52+
"packager": "arduino",
53+
"name": "bossac",
54+
"version": "1.9.1-arduino2"
55+
},
56+
{
57+
"packager": "arduino",
58+
"name": "zephyr-post-build-tool",
59+
"version": "0.1.0"
60+
}
61+
]
62+
}
63+
]
64+
}
65+
]
66+
}

0 commit comments

Comments
 (0)