-
Notifications
You must be signed in to change notification settings - Fork 0
229 lines (229 loc) · 8.71 KB
/
build.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
name: Build package
on: [ push, pull_request]
jobs:
build-meta:
name: build-meta
runs-on: ubuntu-24.04
outputs:
build-meta-output: >-
${{ steps.build-metadata.outputs.build-meta-output }}
firmware-version: >-
${{ steps.build-metadata.outputs.firmware-version }}
create-release: >-
${{ steps.build-metadata.outputs.create-release }}
sdk-name:
${{ steps.build-metadata.outputs.sdk-name }}
sdk-url:
${{ steps.build-metadata.outputs.sdk-url }}
imagebuilder-name:
${{ steps.build-metadata.outputs.imagebuilder-name }}
imagebuilder-url:
${{ steps.build-metadata.outputs.imagebuilder-url }}
cache-key:
${{ steps.cache-key.outputs.cache-key }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0
submodules: true
- name: Determine Version
id: build-metadata
run: bash $GITHUB_WORKSPACE/contrib/get-version.sh
- name: Determine Cache-Key
id: cache-key
run: >
echo "cache-key=$(bash $GITHUB_WORKSPACE/contrib/cache-key.sh
$GITHUB_WORKSPACE ${{ steps.build-metadata.outputs.sdk-url }})" >> "$GITHUB_OUTPUT"
- name: Create Artifact of build-meta
uses: actions/upload-artifact@v4
with:
name: build-meta
path: ${{ steps.build-metadata.outputs.build-meta-output }}
build-packages:
name: build-packages
runs-on: ubuntu-24.04
needs: build-meta
outputs:
usign-private-key:
${{ steps.build-keypair.outputs.usign-private-key }}
usign-public-key:
${{ steps.build-keypair.outputs.usign-public-key }}
usign-fingerprint:
${{ steps.build-keypair.outputs.usign-singerprint }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0
submodules: true
- name: Install dependencies
run: |
$GITHUB_WORKSPACE/contrib/install-deps.sh
- name: Determine Cache-Key
id: cache-key-sdk
run: >
echo "cache-key=sdk-${{ needs.build-meta.outputs.cache-key }}" >> "$GITHUB_OUTPUT"
- name: Restore Cache
id: restore-cache-sdk
uses: actions/cache/restore@v4
with:
path: /tmp/openwrt-sdk
key: ${{ steps.cache-key-sdk.outputs.cache-key }}
- name: Download SDK
if: steps.restore-cache-sdk.outputs.cache-hit != 'true'
run: |
curl -o /tmp/openwrt-sdk.tar.xz ${{ needs.build-meta.outputs.sdk-url }}
- name: Extract SDK
if : steps.restore-cache-sdk.outputs.cache-hit != 'true'
run: |
tar -xf /tmp/openwrt-sdk.tar.xz -C /tmp
ls /tmp
mv /tmp/${{ needs.build-meta.outputs.sdk-name }} /tmp/openwrt-sdk
- name: Create feeds.conf
if: steps.restore-cache-sdk.outputs.cache-hit != 'true'
run: |
cp /tmp/openwrt-sdk/feeds.conf.default /tmp/openwrt-sdk/feeds.conf
echo "src-link oobfw $GITHUB_WORKSPACE/openwrt" >> /tmp/openwrt-sdk/feeds.conf
echo "src-link oobpkgs $GITHUB_WORKSPACE/packages" >> /tmp/openwrt-sdk/feeds.conf
- name: Install SDK feeds
if: steps.restore-cache-sdk.outputs.cache-hit != 'true'
run: |
cd /tmp/openwrt-sdk
./scripts/feeds update -a
./scripts/feeds install -a
- name: Save cache
id: save-cache-sdk
if: steps.restore-cache-sdk.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: /tmp/openwrt-sdk
key: ${{ steps.cache-key-sdk.outputs.cache-key }}
- name: Get build keypair
id: build-keypair
env:
GHA_PRIVATE_KEY: ${{ secrets.USIGN_PRIVATE_KEY }}
GHA_PUBLIC_KEY: ${{ vars.USIGN_PUBLIC_KEY }}
run: |
bash $GITHUB_WORKSPACE/contrib/build-key.sh /tmp/openwrt-sdk/staging_dir/host/bin/usign
- name: Save secret build-key
run: |
echo "${{ steps.build-keypair.outputs.usign-private-key }}" > /tmp/openwrt-sdk/build-key
- name: Create SDK configuration
run: |
cd /tmp/openwrt-sdk
echo CONFIG_FFDA_OOB_FIRMWARE_VERSION=\"${{ needs.build-meta.outputs.firmware-version }}\" >> /tmp/openwrt-sdk/.config
make defconfig
- name: Build packages
run: |
cd /tmp/openwrt-sdk
make package/ffda-oob-firmware/compile V=s -j4
make package/index
- name: Show binary output directory structure
run: |
tree /tmp/openwrt-sdk/bin
- name: Upload oobfw packages
uses: actions/upload-artifact@v4
with:
name: packages-oobfw
path: /tmp/openwrt-sdk/bin/packages/mips_24kc/oobfw
- name: Upload oobpkgs packages
uses: actions/upload-artifact@v4
with:
name: packages-oobpkgs
path: /tmp/openwrt-sdk/bin/packages/mips_24kc/oobpkgs
build-firmware:
name: build-firmware
runs-on: ubuntu-24.04
needs: [build-packages, build-meta]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: /tmp/packages
- name: Show binary output directory structure
run: |
tree /tmp/packages
- name: Determine Cache-Key
id: cache-key-ib
run: >
echo "cache-key=ib-${{ needs.build-meta.outputs.cache-key }}" >> "$GITHUB_OUTPUT"
- name: Install dependencies
run: |
$GITHUB_WORKSPACE/contrib/install-deps.sh
- name: Restore Cache
id: restore-cache-ib
uses: actions/cache/restore@v4
with:
path: /tmp/openwrt-imagebuilder
key: ${{ steps.cache-key-ib.outputs.cache-key }}
- name: Download Imagebuilder
if: steps.restore-cache-ib.outputs.cache-hit != 'true'
run: |
curl -o /tmp/openwrt-imagebuilder.tar.xz ${{ needs.build-meta.outputs.imagebuilder-url }}
- name: Extract Imagebuilder
if: steps.restore-cache-ib.outputs.cache-hit != 'true'
run: |
tar -xf /tmp/openwrt-imagebuilder.tar.xz -C /tmp
mv /tmp/${{ needs.build-meta.outputs.imagebuilder-name }} /tmp/openwrt-imagebuilder
- name: Save cache
if: steps.restore-cache-ib.outputs.cache-hit != 'true'
id: save-cache-ib
uses: actions/cache/save@v4
with:
path: /tmp/openwrt-imagebuilder
key: ${{ steps.cache-key-ib.outputs.cache-key }}
- name: Save pulic build-key
run: |
echo ${{ needs.build-packages.outputs.usign-public-key }} > /tmp/openwrt-imagebuilder/keys/${{ needs.build-packages.outputs.usign-fingerprint }}
- name: Link repositories
run: |
echo "src oobfw file:///tmp/packages/packages-oobfw" >> /tmp/openwrt-imagebuilder/repositories.conf
echo "src oobpkgs file:///tmp/packages/packages-oobpkgs" >> /tmp/openwrt-imagebuilder/repositories.conf
- name: Set Version information
run: |
sed -i "s/^CONFIG_VERSION_NUMBER.*/CONFIG_VERSION_NUMBER=\"${{ needs.build-meta.outputs.firmware-version }}\"/g" /tmp/openwrt-imagebuilder/.config
sed -i "s/^CONFIG_VERSION_DIST.*/CONFIG_VERSION_DIST=\"ffda-oob\"/g" /tmp/openwrt-imagebuilder/.config
- name: Build images
run: |
cd /tmp/openwrt-imagebuilder
$GITHUB_WORKSPACE/contrib/build-image.sh
- name: Upload firmware images
uses: actions/upload-artifact@v4
with:
name: firmware-images
path: /tmp/openwrt-imagebuilder/bin/targets/ath79/nand
create-release:
name: create-release
runs-on: ubuntu-24.04
permissions:
contents: write
needs: [build-packages, build-firmware, build-meta]
if: ${{ needs.build-meta.outputs.create-release == '1' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: /tmp/artifacts
- name: Show binary output directory structure
run: |
tree /tmp/artifacts
- name:
run: |
mkdir -p /tmp/artifacts-upload
cp /tmp/artifacts/firmware-images/*.bin /tmp/artifacts-upload
cp /tmp/artifacts/firmware-images/*.img /tmp/artifacts-upload
cp /tmp/artifacts/packages-oobfw/*.ipk /tmp/artifacts-upload
cp /tmp/artifacts/packages-oobpkgs/*.ipk /tmp/artifacts-upload
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
body: ${{ github.ref_name }}
files: |
/tmp/artifacts-upload/*