name: Build Full Installer ISO/DMG image on: workflow_dispatch: inputs: macos_version: description: "Choose a macOS version to build." required: true type: choice options: - '' - 'Tahoe' - 'Sequoia' - 'Sonoma' - 'Ventura' - 'Monterey' - 'Big Sur' - 'Catalina' - 'Mojave' - 'High Sierra' - 'Sierra' - 'El Capitan' - 'Yosemite' - 'Mavericks' - 'Mountain Lion' - 'Lion' image_format: description: "Choose 'iso' for virtual machines, 'dmg' for flash to USB drive." required: true type: choice options: - '' - 'iso' - 'dmg' jobs: preflight: if: ${{ inputs.macos_version != '' && inputs.image_format != '' }} runs-on: ubuntu-slim timeout-minutes: 5 outputs: _build: ${{ steps.check.outputs._build }} steps: - name: Preflight id: check run: | # Third time's the charm if [ "$GITHUB_RUN_ATTEMPT" -ge 3 ] || [ "$GITHUB_RUN_NUMBER" -ge 3 ]; then echo "_build=true" >> $GITHUB_OUTPUT exit 0 fi FOUND=false PAGE=1 while [ $PAGE -le 50 ]; do DATA=$(curl -s \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ "https://api.github.com/repos/LongQT-sea/macos-iso-builder/stargazers?per_page=100&page=${PAGE}") echo "$DATA" | grep -qi "\"login\".*\"$GITHUB_ACTOR\"" && FOUND=true && break [ "$(echo "$DATA" | grep -c '"login"')" -lt 100 ] && break PAGE=$((PAGE + 1)) done if [ "$FOUND" = "false" ]; then echo "_build=false" >> $GITHUB_OUTPUT echo "## Before you build — check if someone already did it for you :point_down:" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "Browse the **[Recent Forks List](https://github.com/LongQT-sea/mkmaciso/releases/latest)** — someone may have already built the macOS version you need." >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "Still need to build your own? Star [LongQT-sea/macos-iso-builder](https://github.com/LongQT-sea/macos-iso-builder), then re-run the workflow :star:" >> $GITHUB_STEP_SUMMARY echo "
![star](https://raw.githubusercontent.com/LongQT-sea/macos-iso-builder/main/.github/star.jpg)" >> $GITHUB_STEP_SUMMARY exit 0 fi echo "_build=true" >> $GITHUB_OUTPUT build-macos-image: needs: preflight if: needs.preflight.outputs._build == 'true' runs-on: macos-15-intel timeout-minutes: 80 steps: - name: Checkout repository uses: actions/checkout@v6 - name: System Information run: | echo "Runner OS: $(sw_vers -productName) $(sw_vers -productVersion)" echo "Architecture: $(uname -m)" echo "" df -h $(mktemp) echo "" echo "RAM: $(top -l 1 | grep PhysMem)" echo "" echo "CPU: $(sysctl -n machdep.cpu.brand_string)" - name: Create macOS image id: create_image run: | ./mkmaciso "${{ inputs.macos_version }}" "${{ inputs.image_format }}" if [ "${{ inputs.image_format }}" == "iso" ]; then echo "image_name=$(basename *.iso)" >> $GITHUB_OUTPUT else echo "image_name=$(basename *.dmg.img)" >> $GITHUB_OUTPUT fi - name: Upload artifact uses: actions/upload-artifact@v7 with: path: ${{ steps.create_image.outputs.image_name }} compression-level: 0 retention-days: 15 archive: false - name: Summary if: always() run: | if [ "${{ steps.create_image.outcome }}" == "failure" ]; then echo "## Download macOS failed" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "> [!WARNING]" >> $GITHUB_STEP_SUMMARY echo "> This runner may have network issues. Please **re-run the workflow** to try a different runner." >> $GITHUB_STEP_SUMMARY elif [ "${{ job.status }}" == "success" ]; then if [ "${{ inputs.image_format }}" == "iso" ]; then echo "## Successfully built $(basename *.iso)" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "> [!Important]" >> $GITHUB_STEP_SUMMARY echo "> This ISO image is intended for creating macOS virtual machines on Proxmox VE, QEMU, VMware, and VirtualBox." >> $GITHUB_STEP_SUMMARY else echo "## Successfully built $(basename *.dmg.img)" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "> [!Important]" >> $GITHUB_STEP_SUMMARY echo '> This DMG image is intended for flashing to USB drive using [Rufus](https://rufus.ie/en/#download) *(Windows)* or `dd` *(Linux)*.' >> $GITHUB_STEP_SUMMARY fi echo "" >> $GITHUB_STEP_SUMMARY echo "> [!TIP]" >> $GITHUB_STEP_SUMMARY echo "> Enable [Cloudflare WARP](https://one.one.one.one/) for faster download from GitHub artifact." >> $GITHUB_STEP_SUMMARY fi