Skip to content

Commit b9b81c6

Browse files
s373nZrustyrussell
authored andcommitted
build: Matrix strategy for release builds ([#7776]).
Also modifies the `build-release.sh` script to optionally accept specific distribution targets for Ubuntu releases.
1 parent c99b72d commit b9b81c6

File tree

2 files changed

+46
-8
lines changed

2 files changed

+46
-8
lines changed

.github/workflows/release.yml

+42-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
check:
1414
name: Check
1515
outputs:
16-
version: steps.capture.outputs.version
16+
version: ${{ steps.capture.outputs.version }}
1717
runs-on: ubuntu-24.04
1818
steps:
1919
- name: Git checkout
@@ -37,10 +37,18 @@ jobs:
3737
id: capture
3838
run: echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
3939

40-
release:
41-
name: Release
40+
releases:
41+
name: Releases
4242
needs: check
4343
runs-on: ubuntu-24.04
44+
strategy:
45+
fail-fast: false # Let each build finish.
46+
matrix:
47+
target:
48+
- 'bin-Fedora-28-amd64'
49+
- 'bin-Ubuntu-focal'
50+
- 'bin-Ubuntu-jammy'
51+
- 'bin-Ubuntu-noble'
4452
steps:
4553
- name: Git checkout
4654
uses: actions/checkout@v4
@@ -54,13 +62,41 @@ jobs:
5462
./configure
5563
5664
- name: Build environment setup
57-
run: contrib/cl-repro.sh
65+
run: |
66+
distribution=$(echo ${{ matrix.target }} | cut -d'-' -f3)
67+
echo "Building base image for ${distribution}"
68+
sudo docker run --rm -v $(pwd):/build ubuntu:${distribution} bash -c "\
69+
apt-get update && \
70+
apt-get install -y debootstrap && \
71+
debootstrap ${distribution} /build/${distribution}"
72+
sudo tar -C ${distribution} -c . | docker import - ${distribution}
73+
74+
# Build Docker image
75+
docker build -t cl-repro-${distribution} - < contrib/reprobuild/Dockerfile.${distribution}
76+
if: contains(matrix.target, 'Ubuntu')
5877

5978
- name: Build release
60-
run: tools/build-release.sh bin-Fedora-28-amd64 bin-Ubuntu
79+
run: tools/build-release.sh ${{ matrix.target }}
6180

62-
- name: Upload release artifacts
81+
- name: Upload target artifacts
6382
uses: actions/upload-artifact@v4
6483
with:
6584
path: release/
85+
name: ${{ matrix.target }}
6686
if-no-files-found: error
87+
88+
artifact:
89+
name: Construct release artifact
90+
needs:
91+
- check
92+
- releases
93+
env:
94+
version: ${{ needs.check.outputs.version }}
95+
runs-on: ubuntu-24.04
96+
steps:
97+
- name: Merge artifacts
98+
uses: actions/upload-artifact/merge@v4
99+
with:
100+
name: c-lightning-${{ env.version }}
101+
pattern: bin-*
102+
delete-merged: true

tools/build-release.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,10 @@ for target in $TARGETS; do
153153
docker run --rm=true -w /build $TAG rm -rf /"$VERSION-$platform" /build
154154
echo "Fedora Image Built"
155155
;;
156-
Ubuntu)
157-
for d in focal jammy noble; do
156+
Ubuntu*)
157+
distributions=${platform#Ubuntu-}
158+
[ "$distributions" = "Ubuntu" ] && distributions="focal jammy noble"
159+
for d in $distributions; do
158160
# Capitalize the first letter of distro
159161
D=$(echo "$d" | awk '{print toupper(substr($0,1,1))substr($0,2)}')
160162
echo "Building Ubuntu $D Image"

0 commit comments

Comments
 (0)