-
Notifications
You must be signed in to change notification settings - Fork 3
312 lines (277 loc) · 9.15 KB
/
Copy pathbuild.yml
File metadata and controls
312 lines (277 loc) · 9.15 KB
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
name: Build and Release
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
packages: read
env:
XBPS_ALLOW_RESTRICTED: yes
XBPS_ALLOW_CHROOT_BREAKOUT: yes
jobs:
check-changes:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
should_run: ${{ steps.set-matrix.outputs.should_run }}
steps:
- name: Checkout
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: Determine Systems to Build
id: set-matrix
env:
BEFORE_SHA: ${{ github.event.before }}
run: |
chmod +x vup/scripts/check_changes.py
python3 vup/scripts/check_changes.py
build:
needs: check-changes
if: needs.check-changes.outputs.should_run == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
packages: read
container:
image: ghcr.io/vup-linux/vup-builder:latest
options: --privileged
strategy:
matrix:
include: ${{ fromJson(needs.check-changes.outputs.matrix).include }}
fail-fast: false
concurrency:
group: vup-build-${{ matrix.category }}-${{ matrix.arch }}
cancel-in-progress: true
steps:
- name: Checkout VUP
uses: actions/checkout@v7
with:
path: vup
fetch-depth: 0
- name: Checkout void-packages
uses: actions/checkout@v7
with:
repository: void-linux/void-packages
path: void-packages
- name: Cache xbps-src bootstrap & ccache
id: cache-xbps
uses: actions/cache@v6
with:
path: |
void-packages/masterdir-*
void-packages/hostdir/repocache
void-packages/hostdir/ccache
key: xbps-cache-${{ runner.os }}-${{ hashFiles('void-packages/srcpkgs/base-chroot/template') }}
restore-keys: |
xbps-cache-${{ runner.os }}-
- name: Setup xbps-src
run: |
cd void-packages
cp ../vup/vup/xbps-src .
mkdir -p srcpkgs/core/xbps-triggers
cp -r ../vup/vup/srcpkgs/core/xbps-triggers/* srcpkgs/core/xbps-triggers/
chmod +x xbps-src
echo "XBPS_ALLOW_RESTRICTED=yes" >> etc/conf
echo "XBPS_CCACHE=yes" >> etc/conf
mkdir -p hostdir/ccache
- name: Binary Bootstrap
if: steps.cache-xbps.outputs.cache-hit != 'true'
run: |
cd void-packages
./xbps-src binary-bootstrap
- name: Build Packages (Buffered)
env:
CATEGORY: ${{ matrix.category }}
ARCH: ${{ matrix.arch }}
PACKAGES: ${{ matrix.packages }}
run: |
cd void-packages
python3 ../vup/vup/scripts/build_runner.py
- name: Prepare Artifacts
run: |
mkdir -p dist-out
if [ -d "void-packages/dist" ]; then
cp -r void-packages/dist/* dist-out/
fi
mkdir -p logs-out
cp void-packages/report-${{ matrix.category }}-${{ matrix.arch }}.json logs-out/
cp void-packages/build-logs/*.log logs-out/
- name: Upload Binpkgs
uses: actions/upload-artifact@v7
with:
name: binpkgs-${{ matrix.category }}-${{ matrix.arch }}
path: dist-out
if-no-files-found: ignore
retention-days: 1
- name: Upload Build Logs
uses: actions/upload-artifact@v7
with:
name: build-logs-${{ matrix.category }}-${{ matrix.arch }}
path: logs-out
if-no-files-found: ignore
retention-days: 1
release:
needs: [check-changes, build]
if: needs.check-changes.outputs.should_run == 'true' && always() && needs.build.result == 'success'
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
include: ${{ fromJson(needs.check-changes.outputs.matrix).include }}
fail-fast: false
concurrency:
group: vup-release-${{ matrix.category }}-${{ matrix.arch }}
cancel-in-progress: false
steps:
- name: Set up QEMU
if: matrix.arch != 'x86_64'
uses: docker/setup-qemu-action@v4
with:
cache-image: false
- name: Checkout VUP
uses: actions/checkout@v7
with:
path: vup
- name: Prepare Workspace
run: mkdir -p work/dist
- name: Download Old Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
CATEGORY: ${{ matrix.category }}
ARCH: ${{ matrix.arch }}
run: |
cd work
python3 ../vup/vup/scripts/manage_release.py download || true
- name: Download New Binpkgs
uses: actions/download-artifact@v8
with:
name: binpkgs-${{ matrix.category }}-${{ matrix.arch }}
path: work/dist
- name: Prune Old Packages
env:
CATEGORY: ${{ matrix.category }}
ARCH: ${{ matrix.arch }}
run: |
cd work
rm -f dist/*-repodata*
python3 ../vup/vup/scripts/manage_release.py prune
- name: Sign and Index
env:
XBPS_PRIVATE_KEY: ${{ secrets.XBPS_PRIVATE_KEY }}
run: |
# Map arch to docker platform
case "${{ matrix.arch }}" in
x86_64) PLATFORM="linux/amd64" ;;
aarch64) PLATFORM="linux/arm64" ;;
armv7l) PLATFORM="linux/arm/v7" ;;
*) PLATFORM="linux/amd64" ;;
esac
# Write key if present
[ -n "$XBPS_PRIVATE_KEY" ] && echo "$XBPS_PRIVATE_KEY" > work/privkey.pem
docker run --rm --platform "$PLATFORM" \
-v "$PWD/work/dist:/dist" \
${XBPS_PRIVATE_KEY:+-v "$PWD/work/privkey.pem:/privkey.pem:ro"} \
ghcr.io/void-linux/void-glibc:latest sh -c '
cd /dist
# Remove old signatures - they will be regenerated
rm -f *.sig *.sig2
[ -f /privkey.pem ] && for p in *.xbps; do
[ -e "$p" ] && xbps-rindex --sign-pkg --privkey /privkey.pem "$p"
done
xbps-rindex -a *.xbps
[ -f /privkey.pem ] && xbps-rindex --sign --privkey /privkey.pem --signedby "VUP Builder" .
ls -la *-repodata* 2>/dev/null || echo "No repodata!"
'
rm -f work/privkey.pem
- name: Clean Remote Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
CATEGORY: ${{ matrix.category }}
ARCH: ${{ matrix.arch }}
run: |
cd work
python3 ../vup/vup/scripts/manage_release.py clean_remote
- name: Upload Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ matrix.category }}-${{ matrix.arch }}-current
files: work/dist/*
fail_on_unmatched_files: true
report-status:
needs: [build, release]
if: always() && needs.build.result != 'skipped'
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Download Reports
uses: actions/download-artifact@v8
with:
pattern: build-logs-*
path: reports
merge-multiple: true
- name: Generate Summary
id: summary
run: |
echo "# Build Summary" >> $GITHUB_STEP_SUMMARY
python3 vup/scripts/generate_summary.py reports >> $GITHUB_STEP_SUMMARY
deploy-index:
needs: [check-changes, release]
if: needs.check-changes.outputs.should_run == 'true' && always() && needs.release.result == 'success'
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
concurrency:
group: vup-deploy-index
cancel-in-progress: false
steps:
- name: Checkout VUP
uses: actions/checkout@v7
- name: Generate Global Index
run: |
python3 vup/scripts/generate_index.py
- name: Upload Pages Artifact
uses: actions/upload-pages-artifact@v5
with:
path: public
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5
notify-web:
needs: deploy-index
if: needs.deploy-index.result == 'success'
runs-on: ubuntu-latest
steps:
- name: Trigger vup-web sync
env:
VUP_WEBHOOK_SECRET: ${{ secrets.VUP_WEBHOOK_SECRET }}
run: |
if [ -z "$VUP_WEBHOOK_SECRET" ]; then
echo "VUP_WEBHOOK_SECRET not set; skipping notify."
exit 0
fi
# Give GH Pages CDN a moment to publish the new index.json
sleep 30
curl -fsSL --retry 5 --retry-delay 15 --max-time 600 \
-X POST https://voiduserpackages.org/api/sync \
-H "Content-Type: application/json" \
-H "X-Webhook-Secret: $VUP_WEBHOOK_SECRET" \
-d '{"action":"sync"}'