Repository navigation
311 lines (277 loc) · 9.37 KB
/
Copy pathbuild.yml
File metadata and controls
311 lines (277 loc) · 9.37 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
name: Build packages
on:
push:
branches: [main]
paths-ignore:
- iso/**
- web/**
- .github/workflows/iso.yml
- .github/workflows/pages.yml
schedule:
- cron: "0 18 * * *"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: packages
cancel-in-progress: false
env:
SUITE: trixie-nightly
BUCKET: cutefish-deb
jobs:
changes:
name: Changes
runs-on: ubuntu-24.04
outputs:
changed: ${{ steps.compare.outputs.changed }}
commits: ${{ steps.compare.outputs.commits }}
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Compare with the published build
id: compare
run: |
echo "packaging $GITHUB_SHA" > commits
while read -r project _; do
[[ -z "$project" || "$project" == \#* ]] && continue
grep -qs native "debian/$project/debian/source/format" && continue
echo "$project $(git ls-remote "https://github.com/cutefishos/$project.git" HEAD | cut -f 1)" >> commits
done < versions
cat commits
# The nightly run builds only when a commit moved since the last
# publish; a push or a manual run always builds.
changed=true
if [[ "$GITHUB_EVENT_NAME" == schedule ]] \
&& curl -fsSL "https://download.cutefish.org/debian/dists/$SUITE/commits" | cmp -s - commits; then
changed=false
echo "Nothing changed since the last publish." >> "$GITHUB_STEP_SUMMARY"
fi
echo "changed=$changed" >> "$GITHUB_OUTPUT"
{
echo "commits<<EOF"
cat commits
echo EOF
} >> "$GITHUB_OUTPUT"
# Every architecture builds the same commits, the ones listed above.
build:
name: Debian 13 ${{ matrix.arch }}
needs: changes
if: needs.changes.outputs.changed == 'true'
runs-on: ${{ matrix.runner }}
timeout-minutes: 300
strategy:
matrix:
include:
- arch: amd64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
steps:
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache
df -h /
- name: Checkout
uses: actions/checkout@v7
with:
path: packaging
- name: Check out the projects
env:
COMMITS: ${{ needs.changes.outputs.commits }}
run: |
echo "$COMMITS" | while read -r project commit; do
[[ "$project" == packaging ]] && continue
git init --quiet "$project"
git -C "$project" fetch --quiet --depth 1 "https://github.com/cutefishos/$project.git" "$commit"
git -C "$project" checkout --quiet --detach FETCH_HEAD
done
# Skia's GN binary is built for the runner's architecture.
- name: Cache Skia
uses: actions/cache@v6
with:
path: cutefish-toolkit/third_party/skia
key: skia-${{ matrix.arch }}-${{ hashFiles('cutefish-toolkit/scripts/fetch-skia.sh') }}
- name: Fetch Skia
run: cutefish-toolkit/scripts/fetch-skia.sh
- name: Build
run: |
docker run --rm \
-v "$PWD:/work" \
-w /work \
debian:trixie \
bash -euo pipefail -c '
apt-get update
apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
devscripts \
equivs \
git \
xz-utils
git config --global --add safe.directory "*"
packaging/debian/build.sh --install --snapshot
'
sudo chown -R "$(id -u):$(id -g)" packaging/out
- name: Upload packages
uses: actions/upload-artifact@v7
with:
name: packages-${{ matrix.arch }}
path: |
packaging/out/debian/*
!packaging/out/debian/*-dbgsym_*
if-no-files-found: error
retention-days: 7
repository:
name: Repository
needs: [changes, build]
runs-on: ubuntu-24.04
permissions:
contents: read
id-token: write
attestations: write
steps:
- name: Checkout
uses: actions/checkout@v7
with:
path: packaging
- name: Download packages
uses: actions/download-artifact@v8
with:
pattern: packages-*
path: out
# The amd64 build provides the sources and the Architecture: all
# packages.
- name: Index
env:
SIGNING_KEY: ${{ secrets.APT_SIGNING_KEY }}
run: |
docker run --rm \
-v "$PWD:/work" \
-w /work \
-e SIGNING_KEY \
-e SUITE \
debian:trixie \
bash -euo pipefail -c '
apt-get update
apt-get install -y --no-install-recommends \
apt-utils \
devscripts \
gnupg \
xz-utils
if [[ -n "$SIGNING_KEY" ]]; then
gpg --batch --import <<< "$SIGNING_KEY"
packaging/debian/publish.sh --sign "$SUITE" repo out/packages-amd64 out/packages-arm64
else
packaging/debian/publish.sh "$SUITE" repo out/packages-amd64 out/packages-arm64
fi
'
- name: Checksums
env:
COMMITS: ${{ needs.changes.outputs.commits }}
run: |
sudo chown -R "$(id -u):$(id -g)" repo
echo "$COMMITS" > "repo/dists/$SUITE/commits"
(cd repo && find "pool/$SUITE" -type f | sort | xargs sha256sum) > "repo/dists/$SUITE/SHA256SUMS"
cat "repo/dists/$SUITE/SHA256SUMS"
{
echo "## Commits"
echo '```'
cat "repo/dists/$SUITE/commits"
echo '```'
echo "## SHA-256"
echo '```'
cat "repo/dists/$SUITE/SHA256SUMS"
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
- name: Attest
uses: actions/attest-build-provenance@v4
with:
subject-checksums: repo/dists/${{ env.SUITE }}/SHA256SUMS
- name: Upload repository
uses: actions/upload-artifact@v7
with:
name: cutefish-debian-13
path: repo/
if-no-files-found: error
retention-days: 7
# A clean system on each architecture installs the desktop from the new
# repository, checking its signature too, before anything is published.
install:
name: Install ${{ matrix.arch }}
needs: repository
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
- arch: amd64
runner: ubuntu-24.04
- arch: arm64
runner: ubuntu-24.04-arm
steps:
- name: Download repository
uses: actions/download-artifact@v8
with:
name: cutefish-debian-13
path: repo
- name: Install
run: |
signed=trusted=yes
if [[ -f "repo/dists/$SUITE/InRelease" ]]; then
signed=signed-by=/repo/cutefish.asc
fi
docker run --rm \
-v "$PWD/repo:/repo:ro" \
-e SUITE \
-e SIGNED="$signed" \
-e DEBIAN_FRONTEND=noninteractive \
debian:trixie \
bash -euo pipefail -c '
echo "deb [$SIGNED] file:/repo $SUITE main" > /etc/apt/sources.list.d/cutefish.list
apt-get update
apt-get install -y cutefish-desktop
dpkg -l | grep cutefish
'
publish:
name: Publish
needs: install
runs-on: ubuntu-24.04
permissions:
contents: read
actions: write
steps:
- name: Checkout
uses: actions/checkout@v7
with:
path: packaging
- name: Download repository
uses: actions/download-artifact@v8
with:
name: cutefish-debian-13
path: repo
- name: Publish
env:
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.R2_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.R2_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: auto
run: |
if [[ -z "$R2_ACCOUNT_ID" || ! -f repo/dists/$SUITE/InRelease ]]; then
echo "R2 or the signing key is not configured; skipping."
exit 0
fi
s3() { aws s3 --endpoint-url "https://$R2_ACCOUNT_ID.r2.cloudflarestorage.com" "$@"; }
# New packages go up before the indexes that name them, and old
# ones are removed only after the indexes stop naming them.
s3 sync "repo/pool/$SUITE" "s3://$BUCKET/debian/pool/$SUITE"
s3 sync "repo/dists/$SUITE" "s3://$BUCKET/debian/dists/$SUITE" --delete
s3 cp repo/cutefish.asc "s3://$BUCKET/debian/cutefish.asc"
packaging/web/index.sh root > index.html
s3 cp index.html "s3://$BUCKET/index.html"
s3 cp index.html "s3://$BUCKET/debian/index.html"
s3 sync "repo/pool/$SUITE" "s3://$BUCKET/debian/pool/$SUITE" --delete
# A run started with the workflow's own token is the one kind that may
# start another workflow.
- name: Build the ISO
env:
GH_TOKEN: ${{ github.token }}
run: gh workflow run iso.yml --repo "$GITHUB_REPOSITORY" --ref "$GITHUB_REF_NAME"