From 27c077779af3b54b5f014fa2895d67d88a078cab Mon Sep 17 00:00:00 2001 From: Tieu Long Date: Sun, 1 Mar 2026 20:38:35 +0700 Subject: [PATCH] ci: refactor workflows --- .github/workflows/build-macos-template.yml | 28 ++++++---------------- .github/workflows/build-recovery.yml | 7 +++--- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build-macos-template.yml b/.github/workflows/build-macos-template.yml index 3f6bd9e..62d4b28 100644 --- a/.github/workflows/build-macos-template.yml +++ b/.github/workflows/build-macos-template.yml @@ -19,7 +19,7 @@ jobs: - name: Preflight run: | # Third time's the charm - if [ "${{ github.run_attempt }}" -ge 3 ] || [ "${{ github.run_number }}" -ge 3 ]; then + if [ "$GITHUB_RUN_ATTEMPT" -ge 3 ] || [ "$GITHUB_RUN_NUMBER" -ge 3 ]; then exit 0 fi @@ -29,7 +29,7 @@ jobs: DATA=$(curl -s \ -H "Accept: application/vnd.github+json" \ "https://api.github.com/repos/LongQT-sea/macos-iso-builder/stargazers?per_page=100&page=${PAGE}") - echo "$DATA" | grep -qi '"login".*"${{ github.repository_owner }}"' && FOUND=true && break + echo "$DATA" | grep -qi "\"login\".*\"$GITHUB_ACTOR\"" && FOUND=true && break [ "$(echo "$DATA" | grep -c '"login"')" -lt 100 ] && break PAGE=$((PAGE + 1)) done @@ -42,7 +42,7 @@ jobs: fi - name: Checkout repository - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: System Information run: | @@ -54,37 +54,23 @@ jobs: 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 run: | + sudo bash mkmaciso "${{ inputs.macos_version }}" "${{ inputs.image_format }}" || exit 1 if [ "${{ inputs.image_format }}" == "iso" ]; then - sudo bash mkmaciso "${{ inputs.macos_version }}" iso || exit 1 echo "image_name=$(basename *.iso)" >> $GITHUB_OUTPUT else - sudo bash mkmaciso "${{ inputs.macos_version }}" dmg || exit 1 echo "image_name=$(basename *.dmg.img)" >> $GITHUB_OUTPUT fi - - name: Upload ISO artifact - if: inputs.image_format == 'iso' - uses: actions/upload-artifact@v5 + - name: Upload artifact + uses: actions/upload-artifact@v7 with: name: ${{ steps.create_image.outputs.image_name }} - path: ./*.iso + path: ${{ steps.create_image.outputs.image_name }} compression-level: 0 - retention-days: 15 - - - name: Upload DMG artifact - if: inputs.image_format == 'dmg' - 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() diff --git a/.github/workflows/build-recovery.yml b/.github/workflows/build-recovery.yml index 1a114fe..71628da 100644 --- a/.github/workflows/build-recovery.yml +++ b/.github/workflows/build-recovery.yml @@ -33,7 +33,7 @@ jobs: - name: Preflight run: | # Third time's the charm - if [ "${{ github.run_attempt }}" -ge 3 ] || [ "${{ github.run_number }}" -ge 3 ]; then + if [ "$GITHUB_RUN_ATTEMPT" -ge 3 ] || [ "$GITHUB_RUN_NUMBER" -ge 3 ]; then exit 0 fi @@ -43,7 +43,7 @@ jobs: DATA=$(curl -s \ -H "Accept: application/vnd.github+json" \ "https://api.github.com/repos/LongQT-sea/macos-iso-builder/stargazers?per_page=100&page=${PAGE}") - echo "$DATA" | grep -qi '"login".*"${{ github.repository_owner }}"' && FOUND=true && break + echo "$DATA" | grep -qi "\"login\".*\"$GITHUB_ACTOR\"" && FOUND=true && break [ "$(echo "$DATA" | grep -c '"login"')" -lt 100 ] && break PAGE=$((PAGE + 1)) done @@ -72,8 +72,6 @@ jobs: echo "Python version: $(python3 --version)" - name: Download macrecovery.py - id: download_recovery_image - continue-on-error: true run: | echo "Downloading macrecovery.py from acidanthera/OpenCorePkg..." curl --retry 3 --max-time 10 --connect-timeout 3 -OL "https://raw.githubusercontent.com/acidanthera/OpenCorePkg/master/Utilities/macrecovery/macrecovery.py" @@ -125,6 +123,7 @@ jobs: echo "os_flag=$OS_FLAG" >> $GITHUB_OUTPUT - name: Download macOS Recovery + id: download_recovery_image run: | echo "Downloading macOS ${{ steps.version_info.outputs.version_name }} recovery..."