refactor: move preflight to ubuntu-slim, skip build on non-star instead of failing

This commit is contained in:
Tieu Long committed 2026-04-12 21:51:16 +07:00
1 parent 1d93d13ebd
commit cbf30015e6
2 files changed
+39 -19

No files matched your search

+19 -9
View File
@@ -34,23 +34,23 @@ on:
- 'dmg'
jobs:
build-macos-image:
preflight:
if: ${{ inputs.macos_version != '' && inputs.image_format != '' }}
runs-on: macos-15-intel
timeout-minutes: 80
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
# Most users arrive directly at the Actions tab without reading the README,
# missing the prebuilt images in the Releases tab. Requiring a star (step 1
# of the README) reduces redundant builds — and runner costs — for images
# that may already exist in a recent forks list.
FOUND=false
PAGE=1
while [ $PAGE -le 50 ]; do
@@ -64,15 +64,25 @@ jobs:
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 "If you still need to build your own, star [the repo](https://github.com/LongQT-sea/mkmaciso) first — that's step 1 in the [README](https://github.com/LongQT-sea/macos-iso-builder#how-to-use). :star:" >> $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 "<br>![star](https://raw.githubusercontent.com/LongQT-sea/macos-iso-builder/main/.github/star.jpg)" >> $GITHUB_STEP_SUMMARY
exit 1
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
+20 -10
View File
@@ -24,25 +24,25 @@ on:
type: string
jobs:
build-recovery-iso:
preflight:
if: ${{ inputs.macos_version != '' }}
runs-on: macos-latest
runs-on: ubuntu-slim
permissions:
contents: write # needed to create releases
timeout-minutes: 15
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 2 ] || [ "$GITHUB_RUN_NUMBER" -ge 2 ]; then
if [ "$GITHUB_RUN_ATTEMPT" -ge 3 ] || [ "$GITHUB_RUN_NUMBER" -ge 3 ]; then
echo "_build=true" >> $GITHUB_OUTPUT
exit 0
fi
# Most users arrive directly at the Actions tab without reading the README,
# missing the prebuilt images in the Releases tab. Requiring a star (step 1
# of the README) reduces redundant builds — and runner costs — for images
# that may already exist in a recent forks list.
FOUND=false
PAGE=1
while [ $PAGE -le 50 ]; do
@@ -56,15 +56,25 @@ jobs:
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 "If you still need to build your own, star [the repo](https://github.com/LongQT-sea/mkmaciso) first — that's step 1 in the [README](https://github.com/LongQT-sea/macos-iso-builder#how-to-use). :star:" >> $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 "<br>![star](https://raw.githubusercontent.com/LongQT-sea/macos-iso-builder/main/.github/star.jpg)" >> $GITHUB_STEP_SUMMARY
exit 1
exit 0
fi
echo "_build=true" >> $GITHUB_OUTPUT
build-recovery-iso:
needs: preflight
if: needs.preflight.outputs._build == 'true'
runs-on: macos-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v6