Skip to content

Commit cbf3001

Browse files
committed
refactor: move preflight to ubuntu-slim, skip build on non-star instead of failing
1 parent 1d93d13 commit cbf3001

2 files changed

Lines changed: 39 additions & 19 deletions

File tree

.github/workflows/build-macos-image.yml

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,23 +34,23 @@ on:
3434
- 'dmg'
3535

3636
jobs:
37-
build-macos-image:
37+
preflight:
3838
if: ${{ inputs.macos_version != '' && inputs.image_format != '' }}
39-
runs-on: macos-15-intel
40-
timeout-minutes: 80
39+
runs-on: ubuntu-slim
40+
timeout-minutes: 5
41+
outputs:
42+
_build: ${{ steps.check.outputs._build }}
4143

4244
steps:
4345
- name: Preflight
46+
id: check
4447
run: |
4548
# Third time's the charm
4649
if [ "$GITHUB_RUN_ATTEMPT" -ge 3 ] || [ "$GITHUB_RUN_NUMBER" -ge 3 ]; then
50+
echo "_build=true" >> $GITHUB_OUTPUT
4751
exit 0
4852
fi
4953
50-
# Most users arrive directly at the Actions tab without reading the README,
51-
# missing the prebuilt images in the Releases tab. Requiring a star (step 1
52-
# of the README) reduces redundant builds — and runner costs — for images
53-
# that may already exist in a recent forks list.
5454
FOUND=false
5555
PAGE=1
5656
while [ $PAGE -le 50 ]; do
@@ -64,15 +64,25 @@ jobs:
6464
done
6565
6666
if [ "$FOUND" = "false" ]; then
67+
echo "_build=false" >> $GITHUB_OUTPUT
6768
echo "## Before you build — check if someone already did it for you :point_down:" >> $GITHUB_STEP_SUMMARY
6869
echo "" >> $GITHUB_STEP_SUMMARY
6970
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
7071
echo "" >> $GITHUB_STEP_SUMMARY
71-
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
72+
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
7273
echo "<br>![star](https://raw.githubusercontent.com/LongQT-sea/macos-iso-builder/main/.github/star.jpg)" >> $GITHUB_STEP_SUMMARY
73-
exit 1
74+
exit 0
7475
fi
7576
77+
echo "_build=true" >> $GITHUB_OUTPUT
78+
79+
build-macos-image:
80+
needs: preflight
81+
if: needs.preflight.outputs._build == 'true'
82+
runs-on: macos-15-intel
83+
timeout-minutes: 80
84+
85+
steps:
7686
- name: Checkout repository
7787
uses: actions/checkout@v6
7888

.github/workflows/build-recovery.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,25 @@ on:
2424
type: string
2525

2626
jobs:
27-
build-recovery-iso:
27+
preflight:
2828
if: ${{ inputs.macos_version != '' }}
29-
runs-on: macos-latest
29+
runs-on: ubuntu-slim
3030
permissions:
3131
contents: write # needed to create releases
32-
timeout-minutes: 15
32+
timeout-minutes: 5
33+
outputs:
34+
_build: ${{ steps.check.outputs._build }}
3335

3436
steps:
3537
- name: Preflight
38+
id: check
3639
run: |
3740
# Third time's the charm
38-
if [ "$GITHUB_RUN_ATTEMPT" -ge 2 ] || [ "$GITHUB_RUN_NUMBER" -ge 2 ]; then
41+
if [ "$GITHUB_RUN_ATTEMPT" -ge 3 ] || [ "$GITHUB_RUN_NUMBER" -ge 3 ]; then
42+
echo "_build=true" >> $GITHUB_OUTPUT
3943
exit 0
4044
fi
4145
42-
# Most users arrive directly at the Actions tab without reading the README,
43-
# missing the prebuilt images in the Releases tab. Requiring a star (step 1
44-
# of the README) reduces redundant builds — and runner costs — for images
45-
# that may already exist in a recent forks list.
4646
FOUND=false
4747
PAGE=1
4848
while [ $PAGE -le 50 ]; do
@@ -56,15 +56,25 @@ jobs:
5656
done
5757
5858
if [ "$FOUND" = "false" ]; then
59+
echo "_build=false" >> $GITHUB_OUTPUT
5960
echo "## Before you build — check if someone already did it for you :point_down:" >> $GITHUB_STEP_SUMMARY
6061
echo "" >> $GITHUB_STEP_SUMMARY
6162
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
6263
echo "" >> $GITHUB_STEP_SUMMARY
63-
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
64+
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
6465
echo "<br>![star](https://raw.githubusercontent.com/LongQT-sea/macos-iso-builder/main/.github/star.jpg)" >> $GITHUB_STEP_SUMMARY
65-
exit 1
66+
exit 0
6667
fi
6768
69+
echo "_build=true" >> $GITHUB_OUTPUT
70+
71+
build-recovery-iso:
72+
needs: preflight
73+
if: needs.preflight.outputs._build == 'true'
74+
runs-on: macos-latest
75+
timeout-minutes: 15
76+
77+
steps:
6878
- name: Checkout repository
6979
uses: actions/checkout@v6
7080

0 commit comments

Comments
 (0)