chore(ci): macOS merge

This commit is contained in:
Neko Ayaka
2026-03-23 20:02:36 +08:00
parent 0cd68568a6
commit 7921838244
+34 -6
View File
@@ -302,6 +302,22 @@ jobs:
run: | run: |
pnpm run -F @proj-airi/stage-tamagotchi rename-artifacts ${{ matrix.target }} --release ${{ !inputs.build_only && !inputs.artifacts_only }} --tag ${{ inputs.tag }} --auto-tag ${{ !inputs.build_only }} pnpm run -F @proj-airi/stage-tamagotchi rename-artifacts ${{ matrix.target }} --release ${{ !inputs.build_only && !inputs.artifacts_only }} --tag ${{ inputs.tag }} --auto-tag ${{ !inputs.build_only }}
# NOTICE: electron-builder emits `latest-mac.yml` per macOS architecture, but GitHub Releases can only keep one asset with that exact name.
# NOTICE: publishing both matrix outputs under the generic name causes the last upload to win, which can leave auto-update metadata pinned to a single architecture instead of the merged manifest.
# NOTICE: rename the per-arch manifests before upload so the follow-up merge job can publish the only generic `latest-mac.yml`, whose `files` list contains both arm64 and x64 ZIPs for electron-updater to choose from.
- name: Rename macOS update info (Manual + Release + macOS Only)
if: ${{ github.event_name == 'workflow_dispatch' && !inputs.build_only && !inputs.artifacts_only && (matrix.os == 'macos-26' || matrix.os == 'macos-15-intel') }}
run: |
mv apps/stage-tamagotchi/bundle/latest-mac.yml apps/stage-tamagotchi/bundle/latest-mac-${{ matrix.arch }}.yml
- name: Upload macOS update info (Manual + Release + macOS Only)
if: ${{ github.event_name == 'workflow_dispatch' && !inputs.build_only && !inputs.artifacts_only && (matrix.os == 'macos-26' || matrix.os == 'macos-15-intel') }}
uses: actions/upload-artifact@v7
with:
name: latest-mac-yml-${{ matrix.arch }}
path: apps/stage-tamagotchi/bundle/latest-mac-${{ matrix.arch }}.yml
if-no-files-found: error
- name: Get Linux Artifact Names (Manual + Non-Release + Linux Only) - name: Get Linux Artifact Names (Manual + Non-Release + Linux Only)
if: ${{ github.event_name == 'workflow_dispatch' && !inputs.build_only && inputs.artifacts_only && (matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm') }} if: ${{ github.event_name == 'workflow_dispatch' && !inputs.build_only && inputs.artifacts_only && (matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm') }}
working-directory: ./apps/stage-tamagotchi working-directory: ./apps/stage-tamagotchi
@@ -387,7 +403,8 @@ jobs:
apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}-*.rpm apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}-*.rpm
apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}-*.flatpak apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}-*.flatpak
apps/stage-tamagotchi/bundle/latest.yml apps/stage-tamagotchi/bundle/latest.yml
apps/stage-tamagotchi/bundle/latest-*.yml apps/stage-tamagotchi/bundle/latest-linux*.yml
apps/stage-tamagotchi/bundle/latest-mac-*.yml
append_body: true append_body: true
tag_name: ${{ inputs.tag }} tag_name: ${{ inputs.tag }}
@@ -400,12 +417,20 @@ jobs:
run: | run: |
pnpm run -F @proj-airi/stage-tamagotchi rename-artifacts ${{ matrix.target }} --release --auto-tag pnpm run -F @proj-airi/stage-tamagotchi rename-artifacts ${{ matrix.target }} --release --auto-tag
# NOTICE: electron-builder emits `latest-mac.yml` per macOS architecture, but GitHub Releases can only keep one asset with that exact name.
# NOTICE: publishing both matrix outputs under the generic name causes the last upload to win, which can leave auto-update metadata pinned to a single architecture instead of the merged manifest.
# NOTICE: rename the per-arch manifests before upload so the follow-up merge job can publish the only generic `latest-mac.yml`, whose `files` list contains both arm64 and x64 ZIPs for electron-updater to choose from.
- name: Rename macOS update info (Automatic + macOS Only)
if: ${{ github.event_name == 'release' && (matrix.os == 'macos-26' || matrix.os == 'macos-15-intel') }}
run: |
mv apps/stage-tamagotchi/bundle/latest-mac.yml apps/stage-tamagotchi/bundle/latest-mac-${{ matrix.arch }}.yml
- name: Upload macOS update info (Automatic + macOS Only) - name: Upload macOS update info (Automatic + macOS Only)
if: ${{ github.event_name == 'release' && (matrix.os == 'macos-26' || matrix.os == 'macos-15-intel') }} if: ${{ github.event_name == 'release' && (matrix.os == 'macos-26' || matrix.os == 'macos-15-intel') }}
uses: actions/upload-artifact@v7 uses: actions/upload-artifact@v7
with: with:
name: latest-mac-yml-${{ matrix.arch }} name: latest-mac-yml-${{ matrix.arch }}
path: apps/stage-tamagotchi/bundle/latest-mac.yml path: apps/stage-tamagotchi/bundle/latest-mac-${{ matrix.arch }}.yml
if-no-files-found: error if-no-files-found: error
- name: Get Artifacts Envs (Automatic + Windows Only) - name: Get Artifacts Envs (Automatic + Windows Only)
@@ -458,7 +483,7 @@ jobs:
with: with:
# Possible auto updater files: # Possible auto updater files:
# Windows: latest.yml # Windows: latest.yml
# macOS: latest-mac.yml (arm64), latest-mac.yml (x64) # macOS: latest-mac-arm64.yml, latest-mac-x64.yml, latest-mac.yml (merged in follow-up job)
# Linux: latest-linux-arm64.yml (arm64), latest-linux.yml (x64) # Linux: latest-linux-arm64.yml (arm64), latest-linux.yml (x64)
files: | files: |
apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}-*.exe apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}-*.exe
@@ -468,12 +493,13 @@ jobs:
apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}-*.rpm apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}-*.rpm
apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}-*.flatpak apps/stage-tamagotchi/bundle/${{ env.PRODUCT_NAME }}-*.flatpak
apps/stage-tamagotchi/bundle/latest.yml apps/stage-tamagotchi/bundle/latest.yml
apps/stage-tamagotchi/bundle/latest-*.yml apps/stage-tamagotchi/bundle/latest-linux*.yml
apps/stage-tamagotchi/bundle/latest-mac-*.yml
append_body: true append_body: true
merge-mac-latest: merge-mac-latest:
name: Merge macOS latest-mac.yml name: Merge macOS latest-mac.yml
if: ${{ github.event_name == 'release' }} # Skipping will only exist when triggered by workflow_dispatch. No need to handle here if: ${{ github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && !inputs.build_only && !inputs.artifacts_only) }}
needs: build needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@@ -500,6 +526,8 @@ jobs:
name: latest-mac-yml-arm64 name: latest-mac-yml-arm64
path: artifacts/arm64 path: artifacts/arm64
# NOTICE: the merged `latest-mac.yml` must be the only generic macOS update manifest published to the release.
# NOTICE: electron-updater resolves the correct macOS ZIP from the merged `files` list; if we skip this merge or publish a single-arch file as `latest-mac.yml`, Apple Silicon users can be routed to the wrong build.
- name: Merge latest-mac.yml - name: Merge latest-mac.yml
run: | run: |
pnpm -F @proj-airi/stage-tamagotchi exec tsx scripts/merge-latest-mac.ts \ pnpm -F @proj-airi/stage-tamagotchi exec tsx scripts/merge-latest-mac.ts \
@@ -510,4 +538,4 @@ jobs:
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
files: apps/stage-tamagotchi/bundle/latest-mac.yml files: apps/stage-tamagotchi/bundle/latest-mac.yml
tag_name: ${{ github.event.release.tag_name }} tag_name: ${{ github.event_name == 'release' && github.event.release.tag_name || inputs.tag }}