Skip to content

Build ISO

Build ISO #244

Workflow file for this run

name: Build ISO
permissions:
contents: write
packages: read
pull-requests: write
on:
# Allows manual triggering
workflow_dispatch:
# Run daily at midnight UTC
schedule:
- cron: '0 0 * * *'
env:
DOCKER_BUILDKIT: 1
PACMAN_CACHE: /tmp/pacman-cache
WORKSPACE: /workdir
BUILD_DIR: /workdir/work
OUTPUT_DIR: /workdir/out
jobs:
build:
name: Build Arch Linux ISO
runs-on: ubuntu-latest
timeout-minutes: 180 # Extended timeout for the full build process
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Environment
run: |
echo "Setting up build environment"
mkdir -p out work
echo "ISO_DATE=$(date +'%Y.%m.%d')" >> $GITHUB_ENV
echo "RELEASE_TAG=v$(date +'%Y.%m.%d')" >> $GITHUB_ENV
- name: Cache Pacman packages
uses: actions/cache@v4
with:
path: ${{ env.PACMAN_CACHE }}
key: archlinux-pacman-${{ hashFiles('packages.x86_64', 'bootstrap_packages.x86_64') }}
restore-keys: |
archlinux-pacman-
- name: Set up Docker Container
run: |
# Ensure package cache directory exists
mkdir -p ${{ env.PACMAN_CACHE }}
# Build the Docker image with proper error handling
docker build -t arch-iso-builder -f dockerfile . || {
echo "::error::Failed to build Docker image"
exit 1
}
- name: Build ISO
run: |
# Run the ISO build with privileged mode to allow loop device mounting
# The 'build' command is passed to the entrypoint script
docker run --rm --privileged \
-v ${{ github.workspace }}:${{ env.WORKSPACE }} \
-v ${{ env.PACMAN_CACHE }}:/var/cache/pacman/pkg \
arch-iso-builder build out work || {
echo "::error::ISO build failed"
exit 1
}
- name: Generate Checksums
run: |
cd out
# Check if ISO file exists
if ! ls *.iso &>/dev/null; then
echo "::error::No ISO file found in output directory"
exit 1
fi
# Get the ISO filename
ISO_FILE=$(ls *.iso | head -n1)
echo "ISO_FILENAME=$ISO_FILE" >> $GITHUB_ENV
# Create checksums
sha256sum "$ISO_FILE" > $ISO_FILE.sha256
sha512sum "$ISO_FILE" > $ISO_FILE.sha512
# Rename ISO for better identification
RENAMED_ISO="archlinux-nobeep-${{ env.ISO_DATE }}.iso"
mv "$ISO_FILE" "$RENAMED_ISO"
echo "RENAMED_ISO=$RENAMED_ISO" >> $GITHUB_ENV
- name: Generate Package Updates for Release Notes
run: |
# Create directory for package tracking output
mkdir -p /tmp/package-versions
# Run package tracking script with proper error handling
echo "Running package tracking script..."
docker run --rm \
-v ${{ github.workspace }}:${{ env.WORKSPACE }} \
-v /tmp/package-versions:/tmp/package-versions \
arch-iso-builder shell "cd ${{ env.WORKSPACE }} && ./scripts/package_tracking/track_package_updates.sh" || {
echo "::warning::Package tracking failed, continuing with simplified release notes"
# Ensure the directory exists even if command failed
mkdir -p /tmp/package-versions
}
# Prepare release notes
echo "Generating release notes"
{
echo "# Arch Linux No Beep ISO - ${{ env.ISO_DATE }}"
echo ""
echo "## 📦 Automated Build"
echo ""
echo "This ISO was automatically built on $(date +'%Y-%m-%d %H:%M:%S %Z')"
echo ""
echo "### 🔧 Changes"
echo ""
echo "- Updated base packages to latest Arch Linux versions"
echo "- All system beeps disabled by default"
echo "- Performance optimizations for faster boot"
echo ""
if [ -f "/tmp/package-versions/package_updates.md" ]; then
echo "### 📊 Package Updates"
echo ""
cat "/tmp/package-versions/package_updates.md"
else
echo "No detailed package information available for this build."
fi
} > release_notes.md
# Verify release notes were created
if [ ! -s release_notes.md ]; then
echo "::warning::Release notes file is empty, creating fallback content"
echo "# Arch Linux No Beep ISO - ${{ env.ISO_DATE }}" > release_notes.md
echo "" >> release_notes.md
echo "This ISO was automatically built on $(date +'%Y-%m-%d %H:%M:%S %Z')" >> release_notes.md
fi
# Ensure DETAILED_RELEASE_NOTES.md is created
cp release_notes.md DETAILED_RELEASE_NOTES.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
out/${{ env.RENAMED_ISO }}
out/${{ env.RENAMED_ISO }}.sha256
out/${{ env.RENAMED_ISO }}.sha512
name: "Arch Linux No Beeps - ${{ env.ISO_DATE }}"
tag_name: ${{ env.RELEASE_TAG }}
body_path: DETAILED_RELEASE_NOTES.md
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Clean Up
if: always()
run: |
sudo rm -rf out/ work/
docker image rm arch-iso-builder || true