1+ name : Build ISO
2+
3+ on :
4+ workflow_dispatch :
5+ schedule :
6+ - cron : ' 0 0 * * *' # Run the workflow every day at midnight
7+ push :
8+ branches :
9+ - main
10+ paths-ignore :
11+ - ' **.md'
12+ - ' .gitignore'
13+
14+ env :
15+ DOCKER_BUILDKIT : 1
16+ ISO_FILENAME : Arch.iso
17+
18+ jobs :
19+ build :
20+ runs-on : ubuntu-latest
21+ timeout-minutes : 120 # Set a timeout to prevent hung builds
22+
23+ steps :
24+ - name : Checkout Repository
25+ uses : actions/checkout@v4
26+
27+ - name : Set up environment variables
28+ id : env
29+ run : |
30+ echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
31+ echo "VERSION=$(date +'%Y.%m.%d')" >> $GITHUB_ENV
32+ echo "CACHE_KEY=$(date +'%Y-%m')" >> $GITHUB_ENV
33+ echo "WORKSPACE=${GITHUB_WORKSPACE}" >> $GITHUB_ENV
34+
35+ - name : Create Cache Directories
36+ run : |
37+ sudo mkdir -p /tmp/pacman-cache
38+ sudo chmod 777 /tmp/pacman-cache
39+ # Ensure the directory is empty to prevent tar errors
40+ sudo rm -rf /tmp/pacman-cache/*
41+
42+ - name : Cache Pacman packages
43+ uses : actions/cache@v3
44+ with :
45+ path : /tmp/pacman-cache
46+ key : pacman-${{ runner.os }}-${{ env.CACHE_KEY }}
47+ restore-keys : |
48+ pacman-${{ runner.os }}-
49+
50+ - name : Set up Arch Linux Container
51+ run : |
52+ docker run --privileged --name arch-container -d \
53+ -v ${{ env.WORKSPACE }}:/workdir \
54+ -v /tmp/pacman-cache:/var/cache/pacman/pkg \
55+ archlinux:latest sleep infinity
56+
57+ - name : Initialize Container
58+ run : |
59+ docker exec arch-container bash -c "
60+ set -euo pipefail
61+
62+ # Update package database and system
63+ pacman -Syu --noconfirm
64+
65+ # Install required packages
66+ pacman -S --noconfirm --needed \
67+ git \
68+ archiso \
69+ grub \
70+ curl \
71+ jq \
72+ gnupg \
73+ make \
74+ sudo
75+
76+ # Verify installation
77+ command -v mkarchiso >/dev/null 2>&1 || {
78+ echo '::error::mkarchiso not found'
79+ exit 1
80+ }
81+ "
82+
83+ - name : Build ISO
84+ id : build
85+ run : |
86+ docker exec arch-container bash -c "
87+ set -euo pipefail
88+ cd /workdir
89+
90+ # Cleanup any previous builds
91+ rm -rf workdir/ out/
92+ mkdir -p out/
93+
94+ # Build the ISO with verbose output
95+ mkarchiso -v -w workdir/ -o out/ . 2>&1 | tee build.log || {
96+ echo '::error::ISO build failed!'
97+ tail -n 50 build.log
98+ exit 1
99+ }
100+
101+ # Verify ISO was created
102+ [ -f out/*.iso ] || {
103+ echo '::error::ISO file not found after build'
104+ exit 1
105+ }
106+ "
107+
108+ - name : Generate Checksums
109+ run : |
110+ docker exec arch-container bash -c "
111+ set -euo pipefail
112+ cd /workdir/out
113+
114+ # Generate checksums
115+ for iso in *.iso; do
116+ sha256sum \"\$iso\" > \"\${iso}.sha256sum\"
117+ sha512sum \"\$iso\" > \"\${iso}.sha512sum\"
118+ done
119+ "
120+
121+ - name : Rename and Move ISO
122+ run : |
123+ docker exec arch-container bash -c "
124+ set -euo pipefail
125+ cd /workdir/out
126+
127+ for f in *.iso; do
128+ newname=\"arch-linux-no-beeps-${{ env.VERSION }}.iso\"
129+ mv \"\$f\" \"\$newname\"
130+ mv \"\$f.sha256sum\" \"\$newname.sha256sum\"
131+ mv \"\$f.sha512sum\" \"\$newname.sha512sum\"
132+ done
133+ "
134+
135+ - name : Generate Release Notes
136+ id : release_notes
137+ run : |
138+ # Create a temporary file for release notes
139+ TEMP_RELEASE_NOTES=$(mktemp)
140+
141+ docker exec arch-container bash -c "
142+ set -euo pipefail
143+ cd /workdir
144+
145+ # Initialize release notes
146+ {
147+ echo '🚀 Arch Linux ISO without system beeps (build ${{ env.DATE }})'
148+ echo ''
149+ echo '### Changes'
150+
151+ # Get changes since last release
152+ if git tag | grep -q .; then
153+ LAST_TAG=\$(git describe --tags --abbrev=0 2>/dev/null || echo '')
154+ if [ ! -z \"\$LAST_TAG\" ]; then
155+ echo '#### Commits since last release:'
156+ git log \"\$LAST_TAG\"..HEAD --pretty=format:'- %s' | grep -v 'Merge'
157+ echo ''
158+ fi
159+ fi
160+
161+ # Add standard information
162+ echo '### Features'
163+ echo '- Automatic daily build'
164+ echo '- System beeps disabled'
165+ echo '- ISO SHA256 and SHA512 checksums included'
166+ echo ''
167+ echo '### Download'
168+ echo '- Download the ISO and verify checksums before use'
169+ echo ''
170+ echo '### Checksums'
171+ echo 'SHA256 and SHA512 checksums are available in the uploaded files.'
172+ } > /tmp/release_notes
173+ "
174+
175+ # Copy release notes from container to host
176+ docker cp arch-container:/tmp/release_notes $TEMP_RELEASE_NOTES
177+
178+ # Set the release notes in GITHUB_ENV
179+ echo 'RELEASE_NOTES<<EOF' >> $GITHUB_ENV
180+ cat $TEMP_RELEASE_NOTES >> $GITHUB_ENV
181+ echo 'EOF' >> $GITHUB_ENV
182+
183+ # Cleanup
184+ rm -f $TEMP_RELEASE_NOTES
185+
186+ - name : Create Release
187+ id : create_release
188+ uses : softprops/action-gh-release@v1
189+ if : github.ref == 'refs/heads/main'
190+ with :
191+ tag_name : v${{ env.VERSION }}
192+ name : " Arch Linux No Beeps v${{ env.VERSION }}"
193+ body : ${{ env.RELEASE_NOTES }}
194+ draft : false
195+ prerelease : false
196+ files : |
197+ ${{ env.WORKSPACE }}/out/*.iso
198+ ${{ env.WORKSPACE }}/out/*.sha*sum
199+
200+ - name : Clean Up
201+ if : always()
202+ run : |
203+ if docker ps -a | grep -q arch-container; then
204+ docker stop arch-container || true
205+ docker rm -f arch-container || true
206+ fi
207+ sudo rm -rf workdir/ out/ /tmp/pacman-cache/*
208+
209+ - name : Upload Build Logs on Failure
210+ if : failure()
211+ uses : actions/upload-artifact@v4 # Upgrade to v4
212+ with :
213+ name : build-logs
214+ path : |
215+ ${{ env.WORKSPACE }}/build.log
216+ retention-days : 5
217+ compression-level : 9 # Maximum compression for logs
0 commit comments