Skip to content

Commit 4801776

Browse files
committed
update build for using builder images
1 parent 862f5af commit 4801776

File tree

1 file changed

+107
-86
lines changed

1 file changed

+107
-86
lines changed

.github/workflows/build.yml

Lines changed: 107 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -53,93 +53,116 @@ jobs:
5353
git config --local user.name "Github Action"
5454
git commit -m "Bake HTML files in WebDB.cpp"
5555
git push origin main
56-
57-
build_debian:
58-
if: true
59-
env:
60-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61-
RUN_NUMBER: ${{ needs.bakeHTML.outputs.run_number }}
62-
needs: bakeHTML
63-
runs-on: ubuntu-latest
64-
strategy:
65-
matrix:
66-
codename: ['bookworm', 'bullseye', 'trixie']
67-
arch: ['amd64', 'armhf', 'arm64']
68-
steps:
69-
- name: Checkout Repository
70-
uses: actions/checkout@v4
71-
with:
72-
fetch-depth: 0
73-
ref: main
74-
- name: Set filename
75-
run: |
76-
echo "filename=ais-catcher_debian_${{ matrix.codename }}_${{ matrix.arch }}.deb" >> $GITHUB_ENV
7756
78-
- name: Setup QEMU
79-
uses: docker/setup-qemu-action@v3
57+
build_packages:
58+
if: true
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
RUN_NUMBER: ${{ needs.bakeHTML.outputs.run_number }}
62+
needs: bakeHTML
63+
runs-on: ubuntu-latest
64+
strategy:
65+
matrix:
66+
distro: ['debian', 'ubuntu']
67+
codename:
68+
- bookworm
69+
- bullseye
70+
- trixie
71+
- focal
72+
- jammy
73+
- noble
74+
- plucky
75+
- questing
76+
- resolute
77+
arch: ['amd64', 'armhf', 'arm64']
78+
exclude:
79+
- distro: debian
80+
codename: focal
81+
- distro: debian
82+
codename: jammy
83+
- distro: debian
84+
codename: noble
85+
- distro: debian
86+
codename: plucky
87+
- distro: debian
88+
codename: questing
89+
- distro: debian
90+
codename: resolute
91+
- distro: ubuntu
92+
codename: bookworm
93+
- distro: ubuntu
94+
codename: bullseye
95+
- distro: ubuntu
96+
codename: trixie
97+
- distro: ubuntu
98+
arch: armhf
99+
- distro: ubuntu
100+
arch: arm64
101+
steps:
102+
- name: Checkout Repository
103+
uses: actions/checkout@v4
104+
with:
105+
fetch-depth: 0
106+
ref: main
107+
108+
- name: Set filename
109+
run: |
110+
echo "filename=ais-catcher_${{ matrix.distro }}_${{ matrix.codename }}_${{ matrix.arch }}.deb" >> $GITHUB_ENV
80111
81-
- name: Setup Buildx
82-
uses: docker/setup-buildx-action@v3
83-
84-
- name: Build Debian package
85-
run: |
86-
sudo apt-get update
87-
export RUN_NUMBER=${{ needs.bakeHTML.outputs.run_number }}
88-
cp build-docker/bookworm/Dockerfile .
89-
sed -i 's/FROM debian:bookworm/FROM debian:${{ matrix.codename }}/g' Dockerfile
90-
sed -i 's/amd64/${{ matrix.arch }}/g' Dockerfile
91-
#sudo apt-get install qemu-user-static
92-
#docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
93-
#docker build --platform ${{ matrix.arch}} -t ais-catcher-builder-debian-${{ matrix.codename }}-${{ matrix.arch }} .
94-
#docker run --rm -v "$(pwd)/output:/output" ais-catcher-builder-debian-${{ matrix.codename }}-${{ matrix.arch }}
95-
docker buildx build --build-arg RUN_NUMBER=${RUN_NUMBER} --platform linux/${{ matrix.arch }} -t ais-catcher-builder-debian-${{ matrix.codename }}-${{ matrix.arch }} --load .
96-
docker run --rm -v "$(pwd)/output:/output" ais-catcher-builder-debian-${{ matrix.codename }}-${{ matrix.arch }}
97-
cp output/ais-catcher.deb ${{ env.filename }}
98-
gh release upload 'Edge' ${{ env.filename }} --repo ${{ github.repository }} --clobber
99-
- name: Upload Debian package as artifact
100-
uses: actions/upload-artifact@v4
101-
with:
102-
name: ${{ env.filename }}
103-
path: ${{ env.filename }}
104-
105-
build_ubuntu:
106-
env:
107-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108-
RUN_NUMBER: ${{ needs.bakeHTML.outputs.run_number }}
109-
needs: bakeHTML
110-
runs-on: ubuntu-latest
111-
strategy:
112-
matrix:
113-
codename: ['focal', 'jammy', 'noble', 'plucky', 'questing', 'resolute']
114-
arch: ['amd64']
115-
steps:
116-
- name: Checkout Repository
117-
uses: actions/checkout@v4
118-
with:
119-
fetch-depth: 0
120-
ref: main
121-
- name: Set filename
122-
run: |
123-
echo "filename=ais-catcher_ubuntu_${{ matrix.codename }}_${{ matrix.arch }}.deb" >> $GITHUB_ENV
124-
- name: Build Ubuntu package
125-
run: |
126-
export RUN_NUMBER=${{ needs.bakeHTML.outputs.run_number }}
127-
cp build-docker/bookworm/Dockerfile .
128-
sed -i 's/FROM debian:bookworm/FROM ubuntu:${{ matrix.codename }}/g' Dockerfile
129-
sed -i 's/amd64/${{ matrix.arch }}/g' Dockerfile
130-
docker build --build-arg RUN_NUMBER=${RUN_NUMBER} -t ais-catcher-builder-ubuntu-${{ matrix.codename }}-${{ matrix.arch }} .
131-
docker run --rm -v "$(pwd)/output:/output" ais-catcher-builder-ubuntu-${{ matrix.codename }}-${{ matrix.arch }}
132-
cp output/ais-catcher.deb ${{ env.filename }}
133-
gh release upload 'Edge' ${{ env.filename }} --repo ${{ github.repository }} --clobber
134-
- name: Upload Ubuntu package as artifact
135-
uses: actions/upload-artifact@v4
136-
with:
137-
name: ${{ env.filename }}
138-
path: ${{ env.filename }}
112+
- name: Setup QEMU
113+
uses: docker/setup-qemu-action@v3
114+
115+
- name: Setup Buildx
116+
uses: docker/setup-buildx-action@v3
139117

118+
- name: Login to GitHub Container Registry
119+
uses: docker/login-action@v3
120+
with:
121+
registry: ghcr.io
122+
username: ${{ github.actor }}
123+
password: ${{ secrets.GITHUB_TOKEN }}
124+
125+
- name: Pull fresh builder image
126+
run: |
127+
docker pull ghcr.io/${{ github.repository_owner }}/ais-catcher-builder:${{ matrix.distro }}-${{ matrix.codename }}
128+
129+
- name: Build package
130+
run: |
131+
export RUN_NUMBER=${{ needs.bakeHTML.outputs.run_number }}
132+
mkdir -p output
133+
docker run --rm --pull=always --platform linux/${{ matrix.arch }} \
134+
-v "$(pwd):/workspace" \
135+
-w /workspace \
136+
-e RUN_NUMBER=${RUN_NUMBER} \
137+
-e OUTPUT_DIR=/workspace/output \
138+
ghcr.io/${{ github.repository_owner }}/ais-catcher-builder:${{ matrix.distro }}-${{ matrix.codename }} \
139+
./scripts/build-debian-package.sh
140+
141+
# Find the generated .deb file and rename it
142+
DEB_FILE=$(find output -name "*.deb" -not -name "*dbgsym*" | head -n 1)
143+
if [ -n "$DEB_FILE" ]; then
144+
cp "$DEB_FILE" ${{ env.filename }}
145+
else
146+
echo "ERROR: No .deb file found in output directory"
147+
ls -la output/
148+
exit 1
149+
fi
150+
151+
- name: Upload to release
152+
env:
153+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
154+
run: |
155+
gh release upload 'Edge' ${{ env.filename }} --repo ${{ github.repository }} --clobber
156+
157+
- name: Upload package as artifact
158+
uses: actions/upload-artifact@v4
159+
with:
160+
name: ${{ env.filename }}
161+
path: ${{ env.filename }}
162+
140163
Docker:
141164
runs-on: ubuntu-latest
142-
needs: build_debian
165+
needs: build_packages
143166
steps:
144167
- name: Checkout Repository
145168
uses: actions/checkout@v4
@@ -327,7 +350,7 @@ jobs:
327350
- name: Download SDRPlay API
328351
run: |
329352
cd "C:/Program Files/"
330-
Invoke-WebRequest -Uri " https://www.sdrplay.com/software/SDRplay_RSP_API-Windows-3.09.exe" -OutFile sdrplay.exe
353+
Invoke-WebRequest -Uri "https://www.sdrplay.com/software/SDRplay_RSP_API-Windows-3.09.exe" -OutFile sdrplay.exe
331354
choco install innoextract
332355
innoextract sdrplay.exe
333356
ren app SDRplay
@@ -366,6 +389,4 @@ jobs:
366389
run: |
367390
Compress-Archive -Path output/* -DestinationPath "output/AIS-catcher SDRPLAY ${{matrix.platform}}.zip"
368391
bash -c "gh release upload 'Edge' './output/AIS-catcher SDRPLAY ${{matrix.platform}}.zip' --repo ${{ github.repository }} --clobber"
369-
del "output\AIS-catcher SDRPLAY ${{matrix.platform}}.zip"
370-
371-
392+
del "output\AIS-catcher SDRPLAY ${{matrix.platform}}.zip"

0 commit comments

Comments
 (0)