Repository navigation
134 lines (128 loc) · 3.62 KB
/
Copy pathrootfs.yml
File metadata and controls
134 lines (128 loc) · 3.62 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
name: Rootfs
on:
schedule:
# Monday 04:17 UTC. The job resolves Debian stable, the newest Ubuntu
# LTS, and Alpine latest-stable itself, so point releases do not need
# a workflow edit.
- cron: "17 4 * * 1"
workflow_dispatch:
inputs:
distro:
description: Distro
type: choice
options:
- all
- debian
- ubuntu
- alpine
default: all
arch:
description: Architecture
type: choice
options:
- all
- amd64
- arm64
default: all
push:
branches: [main]
paths:
- ".github/workflows/rootfs.yml"
- "scripts/**"
permissions:
contents: read
concurrency:
group: boxrootfs
cancel-in-progress: true
jobs:
resolve:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set.outputs.matrix }}
steps:
- uses: actions/checkout@v7
- id: set
env:
DISTRO: ${{ github.event.inputs.distro || 'all' }}
ARCH: ${{ github.event.inputs.arch || 'all' }}
run: |
{
echo "matrix<<EOF"
python3 scripts/resolve.py
echo "EOF"
} >> "$GITHUB_OUTPUT"
build:
name: ${{ matrix.distro }} ${{ matrix.arch }}
needs: resolve
runs-on: ubuntu-latest
timeout-minutes: 90
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.resolve.outputs.matrix) }}
steps:
- uses: actions/checkout@v7
- name: Build ${{ matrix.distro }} ${{ matrix.arch }}
env:
DISTRO: ${{ matrix.distro }}
ARCH: ${{ matrix.arch }}
DISTRO_ARCH: ${{ matrix.distro_arch }}
UNAME: ${{ matrix.uname }}
QEMU: ${{ matrix.qemu }}
VERSION: ${{ matrix.version }}
CODENAME: ${{ matrix.codename }}
CHANNEL: ${{ matrix.channel }}
FILENAME: ${{ matrix.filename }}
UPSTREAM_URL: ${{ matrix.upstream_url }}
UPSTREAM_SHA256: ${{ matrix.upstream_sha256 }}
run: ./scripts/build.sh
- uses: actions/upload-artifact@v7
with:
name: rootfs-${{ matrix.distro }}-${{ matrix.arch }}
path: |
out/*.tar.xz
out/*.meta.json
if-no-files-found: error
retention-days: 7
release:
needs: build
if: success()
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: actions/download-artifact@v8
with:
pattern: rootfs-*
path: images
merge-multiple: true
- name: Publish release
env:
GH_TOKEN: ${{ github.token }}
run: |
base=$(date -u +%Y.%m.%d)
tag=$base
n=1
while gh release view "$tag" >/dev/null 2>&1; do
n=$((n + 1))
tag="${base}.${n}"
done
python3 scripts/publish.py images "$tag" "$GITHUB_REPOSITORY" latest.json notes.md
gh release create "$tag" \
--target "$GITHUB_SHA" \
--title "Rootfs ${tag}" \
--notes-file notes.md \
images/*.tar.xz \
images/SHA256SUMS \
images/manifest.json
git add latest.json
git -c user.name="lemonhub-io" -c user.email="lemonhub.io@icloud.com" \
commit -m "Update latest.json for ${tag}"
git push origin HEAD:main || {
git fetch origin main
git -c user.name="lemonhub-io" -c user.email="lemonhub.io@icloud.com" \
rebase origin/main
git push origin HEAD:main
}