add support for dmg format and update README
This commit is contained in:
1 parent
a3f18d815e
commit
4f738d04cb
2 files changed
+163
-45
No files matched your search
+127
-18
@@ -1,4 +1,4 @@
|
||||
name: Build macOS Installer ISO image
|
||||
name: Build macOS Installer ISO/DMG image
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -17,13 +17,20 @@ on:
|
||||
- 'Catalina'
|
||||
- 'Mojave'
|
||||
- 'High Sierra'
|
||||
image_format:
|
||||
description: 'Select image format, iso for VM, dmg for burn to USB drive'
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- 'iso'
|
||||
- 'dmg'
|
||||
specific_version:
|
||||
description: 'Specific version number (optional, e.g., 15.0.1)'
|
||||
description: 'Optional: Specific version number, e.g., 15.7.1'
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
build-iso:
|
||||
build-installer:
|
||||
runs-on: macos-15-intel
|
||||
timeout-minutes: 120
|
||||
|
||||
@@ -54,7 +61,7 @@ jobs:
|
||||
else
|
||||
# Get latest version for selected macOS
|
||||
INSTALLER_VERSION=$(grep "${{ github.event.inputs.macos_version }}" installers.txt | head -1 | sed -n 's/.*Version: \([^,]*\).*/\1/p')
|
||||
echo "Found latest version: $INSTALLER_VERSION"
|
||||
echo "Found latest ${{ github.event.inputs.macos_version }} version: $INSTALLER_VERSION"
|
||||
fi
|
||||
|
||||
if [ -z "$INSTALLER_VERSION" ]; then
|
||||
@@ -79,7 +86,7 @@ jobs:
|
||||
else
|
||||
RETRY_COUNT=$((RETRY_COUNT + 1))
|
||||
echo "Download failed. Retry $RETRY_COUNT of $MAX_RETRIES..."
|
||||
sleep 10
|
||||
sleep 5
|
||||
fi
|
||||
done
|
||||
|
||||
@@ -98,6 +105,7 @@ jobs:
|
||||
echo "Installer found at: $INSTALLER_PATH"
|
||||
|
||||
- name: Create ISO
|
||||
if: github.event.inputs.image_format == 'iso'
|
||||
id: create_iso
|
||||
run: |
|
||||
echo "Creating ISO for macOS ${{ github.event.inputs.macos_version }}"
|
||||
@@ -122,7 +130,7 @@ jobs:
|
||||
sudo "$INSTALLER_PATH/Contents/Resources/createinstallmedia" --volume "/Volumes/$VOLUME_NAME" --nointeraction
|
||||
|
||||
# Should wait for a few seconds
|
||||
sleep 5
|
||||
sync && sleep 5
|
||||
|
||||
# Detach volume
|
||||
echo "Detaching volume..."
|
||||
@@ -135,37 +143,138 @@ jobs:
|
||||
sleep 2
|
||||
|
||||
# Create hybrid ISO
|
||||
echo "Creating hybrid ISO..."
|
||||
hdiutil makehybrid -hfs -udf -o "$ISO_FILE" "$SPARSE_IMAGE"
|
||||
|
||||
# Clean up
|
||||
echo "Cleaning up temporary files..."
|
||||
rm -f "$SPARSE_IMAGE"
|
||||
|
||||
# Show ISO info and set output
|
||||
if [ -f "$ISO_FILE" ]; then
|
||||
ISO_SIZE=$(du -h "$ISO_FILE" | cut -f1)
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "ISO created successfully!"
|
||||
echo "ISO file: $ISO_FILE"
|
||||
echo "ISO size: $ISO_SIZE"
|
||||
echo "iso_size=$ISO_SIZE" >> $GITHUB_OUTPUT
|
||||
echo "iso_file=$ISO_FILE" >> $GITHUB_OUTPUT
|
||||
echo "========================================="
|
||||
echo ""
|
||||
echo "image_size=$ISO_SIZE" >> $GITHUB_OUTPUT
|
||||
echo "image_file=$ISO_FILE" >> $GITHUB_OUTPUT
|
||||
echo "image_name=${ISO_NAME}.iso" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "Error: ISO file not created"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Create DMG
|
||||
if: github.event.inputs.image_format == 'dmg'
|
||||
id: create_dmg
|
||||
run: |
|
||||
echo "Creating macOS ${{ github.event.inputs.macos_version }} DMG image"
|
||||
|
||||
# Set variables
|
||||
DMG_NAME="macOS_${{ github.event.inputs.macos_version }}_${{ steps.fetch_installers.outputs.version }}"
|
||||
DMG_NAME="${DMG_NAME// /_}"
|
||||
DMG_FILE="${GITHUB_WORKSPACE}/${DMG_NAME}.dmg"
|
||||
VOLUME_NAME="Install_Temp"
|
||||
INSTALLER_PATH="/Applications/Install macOS ${{ github.event.inputs.macos_version }}.app"
|
||||
|
||||
echo "DMG will be created at: $DMG_FILE"
|
||||
echo "Using installer at: $INSTALLER_PATH"
|
||||
|
||||
# Step 1: Create a 20GB disk image and attach it
|
||||
echo "Step 1: Creating 20GB DMG disk image..."
|
||||
hdiutil create -size 20g -volname "$VOLUME_NAME" -fs HFS+ -type UDIF -attach "$DMG_FILE"
|
||||
|
||||
# Get the disk identifier
|
||||
DISK_ID=$(diskutil list | grep "$VOLUME_NAME" | head -1 | awk '{print $NF}' | sed 's/s[0-9]*$//')
|
||||
|
||||
# Step 2: Create install media
|
||||
echo "Step 2: Creating install media ..."
|
||||
sudo "$INSTALLER_PATH/Contents/Resources/createinstallmedia" --volume "/Volumes/$VOLUME_NAME" --nointeraction
|
||||
|
||||
sync && sleep 5
|
||||
|
||||
# Step 3: Check minimum size requirements
|
||||
echo "Step 3: Check minimum size requirements..."
|
||||
INSTALLER_PARTITION="/dev/${DISK_ID}s2"
|
||||
diskutil resizeVolume "$INSTALLER_PARTITION" limits | tee resize_limits.txt
|
||||
|
||||
# Extract the byte value from parentheses
|
||||
MIN_SIZE=$(grep "Minimum (constrained by file usage)" resize_limits.txt | sed -n 's/.*(\([0-9]*\) Bytes).*/\1/p')
|
||||
echo "Minimum size: $MIN_SIZE bytes"
|
||||
|
||||
# Step 4: Consolidate installer data by adding a dummy partition, this forces macOS to move all data to the front of the partition
|
||||
echo "Step 4: Resizing and consolidating data..."
|
||||
diskutil resizeVolume "$INSTALLER_PARTITION" "${MIN_SIZE}B" HFS+ Dummy 0
|
||||
|
||||
sync && sleep 5
|
||||
|
||||
# Step 5: Remove dummy partition, leaving free space at the end
|
||||
echo "Step 5: Removing dummy partition..."
|
||||
DUMMY_PARTITION=${DISK_ID}s3
|
||||
diskutil eraseVolume free free "$DUMMY_PARTITION"
|
||||
|
||||
sync && sleep 5
|
||||
|
||||
# Step 6: Expand installer partition back
|
||||
echo "Step 6: Expanding installer partition..."
|
||||
diskutil resizeVolume "$INSTALLER_PARTITION" 0
|
||||
|
||||
sync && sleep 2
|
||||
|
||||
# Step 7: Detach the disk
|
||||
echo "Step 7: Detaching disk..."
|
||||
hdiutil detach "$DISK_ID" || hdiutil detach "$DISK_ID" -force
|
||||
|
||||
sleep 2
|
||||
|
||||
# Step 8: Optimize DMG size
|
||||
echo "Step 8: Optimizing DMG size..."
|
||||
hdiutil resize -size min "$DMG_FILE"
|
||||
|
||||
# Show final DMG info
|
||||
if [ -f "$DMG_FILE" ]; then
|
||||
DMG_SIZE=$(du -h "$DMG_FILE" | cut -f1)
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo "Optimize DMG created successfully!"
|
||||
echo "DMG size: $DMG_SIZE"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
echo "image_size=$DMG_SIZE" >> $GITHUB_OUTPUT
|
||||
echo "image_file=$DMG_FILE" >> $GITHUB_OUTPUT
|
||||
echo "image_name=${DMG_NAME}.dmg" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "Error: DMG file not created"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Upload ISO artifact
|
||||
if: github.event.inputs.image_format == 'iso'
|
||||
uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: macOS-${{ github.event.inputs.macos_version }}-${{ steps.fetch_installers.outputs.version }}-ISO
|
||||
path: ${{ steps.create_iso.outputs.iso_file }}
|
||||
path: ${{ steps.create_iso.outputs.image_file }}
|
||||
compression-level: 0
|
||||
retention-days: 3
|
||||
|
||||
- name: Upload DMG artifact
|
||||
if: github.event.inputs.image_format == 'dmg'
|
||||
uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: macOS-${{ github.event.inputs.macos_version }}-${{ steps.fetch_installers.outputs.version }}-DMG
|
||||
path: ${{ steps.create_dmg.outputs.image_file }}
|
||||
compression-level: 0
|
||||
retention-days: 3
|
||||
|
||||
- name: Summary
|
||||
run: |
|
||||
echo "Successfully built **macOS ${{ github.event.inputs.macos_version }} ${{ steps.fetch_installers.outputs.version }}** ISO" >> $GITHUB_STEP_SUMMARY
|
||||
if [ "${{ github.event.inputs.image_format }}" == "iso" ]; then
|
||||
echo "## Successfully built macOS ${{ github.event.inputs.macos_version }} ${{ steps.fetch_installers.outputs.version }} ISO" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Image Size:** ${{ steps.create_iso.outputs.image_size }}" >> $GITHUB_STEP_SUMMARY
|
||||
else
|
||||
echo "## Successfully built macOS ${{ github.event.inputs.macos_version }} ${{ steps.fetch_installers.outputs.version }} DMG" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Image Size:** ${{ steps.create_dmg.outputs.image_size }}" >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**ISO Size:** ${{ steps.create_iso.outputs.iso_size }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "Download the ISO from the artifacts section below." >> $GITHUB_STEP_SUMMARY
|
||||
echo "Download the installer from the artifacts section below." >> $GITHUB_STEP_SUMMARY
|
||||
@@ -1,39 +1,49 @@
|
||||
# macOS Installer ISO Builder with GitHub Actions
|
||||
|
||||
* Uses GitHub Actions to download official macOS installers directly from Apple servers and create true DVD-format macOS installer ISO files.
|
||||
* The generated ISOs are compatible with **Proxmox VE**, **QEMU**, **VirtualBox**, and **VMware**.
|
||||
Automatically download official macOS installers from Apple and create bootable `iso` or `dmg` images using GitHub Actions.
|
||||
|
||||
**Supported formats:**
|
||||
* **ISO** – true DVD-format compatible with **Proxmox VE**, **QEMU**, **VirtualBox**, and **VMware**
|
||||
* **DMG** – For creating bootable USB drives
|
||||
|
||||
## Workflows Available
|
||||
|
||||
### 1. Recovery ISO (Recommended)
|
||||
Creates a lightweight recovery ISO that downloads macOS during installation.
|
||||
* **Faster** – Completes in ~2-10 minutes
|
||||
* **Best for** – Most virtualization use cases
|
||||
|
||||
### 2. Full Installer image
|
||||
Creates a complete offline installer image (~5-16GB).
|
||||
* **Slower** – Takes 20-60 minutes to build
|
||||
* **Best for** – Offline installations or when you need the complete installer
|
||||
|
||||
> [!Note]
|
||||
> Due to high usage, please use the **“Build macOS Recovery ISO image”** workflow instead of the full installer. This workflow runs much faster compared to the full installer ISO.
|
||||
> You can create the full macOS installer ISO locally on your macOS VM using [OpenCore-ISO/Create_macOS_ISO.command](https://github.com/LongQT-sea/OpenCore-ISO/blob/main/Create_macOS_ISO.command).
|
||||
> Due to GitHub Actions usage limits, please use the **Recovery ISO** workflow unless you specifically need an offline installer.
|
||||
>
|
||||
> **Already have a macOS VM?** You can create full installer ISOs locally using [Create_macOS_ISO.command](https://github.com/LongQT-sea/OpenCore-ISO/blob/main/Create_macOS_ISO.command).
|
||||
|
||||
---
|
||||
|
||||
## 📦 Usage
|
||||
|
||||
### Running the Workflow
|
||||
## Usage
|
||||
|
||||
1. **Fork** this repository.
|
||||
2. Go to the **Actions** tab in your forked repository.
|
||||
3. Click the green **“I understand my workflows, go ahead and enable them”** button.
|
||||
3. Select the **“Build macOS Installer ISO image”** workflow.
|
||||
4. Click the **“Run workflow”** button.
|
||||
5. Set the inputs:
|
||||
3. Click the green button **"I understand my workflows, go ahead and enable them"**.
|
||||
4. Select the **"Build macOS Installer ISO image"** workflow.
|
||||
5. Click the **"Run workflow"** button.
|
||||
6. Configure the workflow inputs:
|
||||
|
||||
* **macOS version** – Choose a version (*Sequoia*, *Sonoma*, etc.).
|
||||
* **Specific version** *(optional)* – Enter a version like `15.7.1`, or leave blank to use the latest.
|
||||
|
||||
6. Click the green **“Run workflow”** button to start the build.
|
||||
|
||||
### 📥 Downloading the ISO
|
||||
> [!Tip]
|
||||
> Enable Cloudflare WARP for faster downloads.
|
||||
|
||||
After the workflow finishes:
|
||||
|
||||
1. Open the completed workflow run.
|
||||
2. Scroll to the **Artifacts** section at the bottom.
|
||||
3. Download the ISO artifact (e.g. `macOS-Sequoia-15.7.1-ISO`).
|
||||
4. Extract the ZIP file to get the `.iso`.
|
||||
* **Image format** – Choose `iso` for Virtual Machines or `dmg` for bootable USB drives.
|
||||
* **Specific version** *(optional)* – Enter a version like `15.6.1`, or leave blank for the latest.
|
||||
7. Click the green **"Run workflow"** button to start the build.
|
||||
8. Wait for the workflow to complete (this may take 15-60 minutes).
|
||||
9. Open the completed workflow run and scroll to the **Artifacts** section.
|
||||
10. Download the artifact (e.g., `macOS-Sequoia-15.6.1-ISO`).
|
||||
> [!Tip]
|
||||
> Enable [Cloudflare WARP](https://one.one.one.one/) for faster downloads.
|
||||
11. Extract the ZIP file to get your `.iso` or `.dmg` file.
|
||||
|
||||
---
|
||||
|
||||
@@ -47,5 +57,4 @@ After the workflow finishes:
|
||||
|
||||
## Legal Notice
|
||||
This tool downloads macOS images directly from Apple's servers.
|
||||
Users are responsible for complying with Apple's Software License Agreement.
|
||||
These ISOs are intended for legitimate virtualization and testing on Apple hardware or authorized platforms.
|
||||
Users are responsible for complying with Apple's Software License Agreement.
|
||||
Reference in new issue
Block a user