refactor(ci): replace duplicated build workflows with reusable template

This commit is contained in:
Tieu Long committed 2026-02-24 23:52:47 +07:00
1 parent 5554730bee
commit bbade1fd13
17 files changed
+208 -1572

No files matched your search

+5 -103
View File
@@ -11,107 +11,9 @@ on:
- 'iso'
- 'dmg'
env:
MACOS_VERSION: 'Monterey'
jobs:
build-macos-image:
runs-on: macos-15-intel
timeout-minutes: 80
steps:
- name: Checkout repository
uses: actions/checkout@v5
- 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)"
echo ""
echo "Model: $(sysctl -n hw.model)"
- name: Create macOS image
id: create_image
continue-on-error: true
run: |
if [ "${{ github.event.inputs.image_format }}" == "iso" ]; then
sudo bash mkmaciso "${{ env.MACOS_VERSION }}" iso
echo "image_name=$(basename *.iso)" >> $GITHUB_OUTPUT
else
sudo bash mkmaciso "${{ env.MACOS_VERSION }}" dmg
echo "image_name=$(basename *.dmg.img)" >> $GITHUB_OUTPUT
fi
- name: Upload ISO artifact
if: github.event.inputs.image_format == 'iso' && steps.create_image.outcome == 'success'
uses: actions/upload-artifact@v5
with:
name: ${{ steps.create_image.outputs.image_name }}
path: ./*.iso
compression-level: 0
retention-days: 15
- name: Upload DMG artifact
if: github.event.inputs.image_format == 'dmg' && steps.create_image.outcome == 'success'
uses: actions/upload-artifact@v5
with:
name: ${{ steps.create_image.outputs.image_name }}
path: ./*.dmg.img
compression-level: 0
retention-days: 15
- 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 [ "${{ github.event.inputs.image_format }}" == "iso" ]; then
echo "## Successfully built $(basename *.iso)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "> [!NOTE]" >> $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 "> [!NOTE]" >> $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
echo '> Can also be used with virtual machines (requires conversion to `.vhd` for Hyper-V or `.vmdk` for VMware).' >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "---" >> $GITHUB_STEP_SUMMARY
echo "<details>" >> $GITHUB_STEP_SUMMARY
echo "<summary>⚠️ Do NOT click this. Seriously.</summary>" >> $GITHUB_STEP_SUMMARY
echo "<details>" >> $GITHUB_STEP_SUMMARY
echo "<summary>⚠️ Final warning. Close this. Walk away.</summary>" >> $GITHUB_STEP_SUMMARY
echo "<br>" >> $GITHUB_STEP_SUMMARY
echo "Of course you clicked. You were always going to click.<br>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "This workflow just pulled a **legit macOS installer straight from Apple's servers** — no torrents, no sketchy mirrors." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**What just happened while you weren't looking:**" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Downloaded directly from Apple — as legit as it gets" >> $GITHUB_STEP_SUMMARY
echo "- ✅ Saved you hours of hunting broken torrents" >> $GITHUB_STEP_SUMMARY
echo "- ✅ No shady third-party sites, no surprise executables" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Now whatever you do, **DO NOT** [⭐ star this repo](https://github.com/LongQT-sea/macos-iso-builder)." >> $GITHUB_STEP_SUMMARY
echo "![star](https://raw.githubusercontent.com/LongQT-sea/mkmaciso/main/.github/star.png)" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Don't share it either. Last thing I need is more people finding something that actually works." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "*(...but if you're the type who does the opposite of what they're told — you know what to do)*" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "> [!TIP]" >> $GITHUB_STEP_SUMMARY
echo "> Enable [Cloudflare WARP](https://one.one.one.one/) for faster downloads." >> $GITHUB_STEP_SUMMARY
fi
build:
uses: ./.github/workflows/build-macos-template.yml
with:
macos_version: 'Monterey'
image_format: ${{ inputs.image_format }}