@@ -25,25 +25,20 @@ jobs:
2525 - name : Checkout Repository
2626 uses : actions/checkout@v4
2727
28- - name : Set up Docker Buildx
29- uses : docker/setup-buildx-action@v3
30- with :
31- buildkitd-flags : --debug
32-
33- - name : Cache Docker layers
34- uses : actions/cache@v3
35- with :
36- path : /tmp/.buildx-cache
37- key : ${{ runner.os }}-buildx-${{ github.sha }}
38- restore-keys : |
39- ${{ runner.os }}-buildx-
40-
4128 - name : Set up environment variables
4229 id : env
4330 run : |
4431 echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
4532 echo "VERSION=$(date +'%Y.%m.%d')" >> $GITHUB_ENV
4633 echo "CACHE_KEY=$(date +'%Y-%m')" >> $GITHUB_ENV
34+ echo "WORKSPACE=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
35+
36+ - name : Create Cache Directories
37+ run : |
38+ sudo mkdir -p /tmp/pacman-cache
39+ sudo chmod 777 /tmp/pacman-cache
40+ sudo mkdir -p /tmp/build-cache
41+ sudo chmod 777 /tmp/build-cache
4742
4843 - name : Cache Pacman packages
4944 uses : actions/cache@v3
@@ -55,18 +50,36 @@ jobs:
5550
5651 - name : Set up Arch Linux Container
5752 run : |
58- mkdir -p /tmp/pacman-cache
5953 docker run --privileged --name arch-container -d \
60- -v ${{ github.workspace }}:/workdir \
54+ -v ${{ env.WORKSPACE }}:/workdir \
6155 -v /tmp/pacman-cache:/var/cache/pacman/pkg \
56+ -v /tmp/build-cache:/var/cache/pacman/pkg \
6257 archlinux:latest sleep infinity
6358
64- - name : Update and Install Dependencies
59+ - name : Initialize Container
6560 run : |
6661 docker exec arch-container bash -c "
6762 set -euo pipefail
63+
64+ # Update package database
6865 pacman -Sy --noconfirm
69- pacman -S --noconfirm --needed git archiso grub curl jq gnupg
66+
67+ # Install required packages
68+ pacman -S --noconfirm --needed \
69+ git \
70+ archiso \
71+ grub \
72+ curl \
73+ jq \
74+ gnupg \
75+ make \
76+ sudo
77+
78+ # Verify installation
79+ command -v mkarchiso >/dev/null 2>&1 || {
80+ echo 'Error: mkarchiso not found'
81+ exit 1
82+ }
7083 "
7184
7285 - name : Build ISO
@@ -75,29 +88,49 @@ jobs:
7588 docker exec arch-container bash -c "
7689 set -euo pipefail
7790 cd /workdir
91+
7892 # Cleanup any previous builds
7993 rm -rf workdir/ out/
94+ mkdir -p out/
95+
8096 # Build the ISO with verbose output
81- mkarchiso -v -w workdir/ -o out/ . || {
82- echo 'ISO build failed!'
97+ mkarchiso -v -w workdir/ -o out/ . 2>&1 | tee build.log || {
98+ echo 'Error: ISO build failed!'
99+ tail -n 50 build.log
100+ exit 1
101+ }
102+
103+ # Verify ISO was created
104+ [ -f out/*.iso ] || {
105+ echo 'Error: ISO file not found after build'
83106 exit 1
84107 }
85108 "
86109
87110 - name : Generate Checksums
88111 run : |
89112 docker exec arch-container bash -c "
113+ set -euo pipefail
90114 cd /workdir/out
91- sha256sum *.iso > sha256sums.txt
92- sha512sum *.iso > sha512sums.txt
115+
116+ # Generate checksums
117+ for iso in *.iso; do
118+ sha256sum \"\$iso\" > \"\${iso}.sha256sum\"
119+ sha512sum \"\$iso\" > \"\${iso}.sha512sum\"
120+ done
93121 "
94122
95123 - name : Rename and Move ISO
96124 run : |
97125 docker exec arch-container bash -c "
126+ set -euo pipefail
98127 cd /workdir/out
128+
99129 for f in *.iso; do
100- mv \"\$f\" \"arch-linux-no-beeps-${{ env.VERSION }}.iso\"
130+ newname=\"arch-linux-no-beeps-${{ env.VERSION }}.iso\"
131+ mv \"\$f\" \"\$newname\"
132+ mv \"\$f.sha256sum\" \"\$newname.sha256sum\"
133+ mv \"\$f.sha512sum\" \"\$newname.sha512sum\"
101134 done
102135 "
103136
@@ -106,8 +139,8 @@ jobs:
106139 with :
107140 name : arch-linux-no-beeps-${{ env.VERSION }}
108141 path : |
109- ${{ github.workspace }}/out/*.iso
110- ${{ github.workspace }}/out/sha*sums.txt
142+ ${{ env.WORKSPACE }}/out/*.iso
143+ ${{ env.WORKSPACE }}/out/*.sha*sum
111144 retention-days : 5
112145
113146 - name : Create Release
@@ -133,17 +166,21 @@ jobs:
133166 draft : false
134167 prerelease : false
135168 files : |
136- ${{ github.workspace }}/out/*.iso
137- ${{ github.workspace }}/out/sha*sums.txt
169+ ${{ env.WORKSPACE }}/out/*.iso
170+ ${{ env.WORKSPACE }}/out/*.sha*sum
138171
139172 - name : Clean Up
140173 if : always()
141174 run : |
142175 docker stop arch-container || true
143176 docker rm arch-container || true
144- rm -rf workdir/ out/
177+ sudo rm -rf workdir/ out/ /tmp/build-cache/*
145178
146- - name : Notify on Failure
179+ - name : Upload Build Logs on Failure
147180 if : failure()
148- run : |
149- echo "::error::ISO build failed! Check the logs for more details."
181+ uses : actions/upload-artifact@v3
182+ with :
183+ name : build-logs
184+ path : |
185+ ${{ env.WORKSPACE }}/build.log
186+ retention-days : 5
0 commit comments