Spaces:
Paused
Paused
icebear0828 commited on
Commit ·
d71ac65
1
Parent(s): 353ecc2
fix: serialize macOS builds to prevent release asset collisions
Browse filesmacOS arm64 and x64 builds were uploading assets in parallel, causing
422 "already_exists" errors for shared files (latest-mac.yml, blockmaps).
Now x64 runs after arm64 completes. Also added a pre-pack step to clean
stale assets from failed reruns.
.github/workflows/release.yml
CHANGED
|
@@ -27,10 +27,6 @@ jobs:
|
|
| 27 |
platform: mac
|
| 28 |
arch: arm64
|
| 29 |
artifact: macos-arm64
|
| 30 |
-
- os: macos-latest
|
| 31 |
-
platform: mac
|
| 32 |
-
arch: x64
|
| 33 |
-
artifact: macos-x64
|
| 34 |
- os: ubuntu-latest
|
| 35 |
platform: linux
|
| 36 |
artifact: linux
|
|
@@ -77,14 +73,99 @@ jobs:
|
|
| 77 |
working-directory: packages/electron
|
| 78 |
run: node electron/prepare-pack.mjs
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
- name: Pack (${{ matrix.platform }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }})
|
| 81 |
working-directory: packages/electron
|
| 82 |
run: npx electron-builder --config electron-builder.yml --${{ matrix.platform }} ${{ matrix.arch && format('--{0}', matrix.arch) || '' }} --publish always
|
| 83 |
env:
|
| 84 |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 85 |
|
| 86 |
-
release
|
|
|
|
|
|
|
| 87 |
needs: build
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
runs-on: ubuntu-latest
|
| 89 |
if: startsWith(github.ref, 'refs/tags/v') || inputs.tag
|
| 90 |
|
|
|
|
| 27 |
platform: mac
|
| 28 |
arch: arm64
|
| 29 |
artifact: macos-arm64
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
- os: ubuntu-latest
|
| 31 |
platform: linux
|
| 32 |
artifact: linux
|
|
|
|
| 73 |
working-directory: packages/electron
|
| 74 |
run: node electron/prepare-pack.mjs
|
| 75 |
|
| 76 |
+
- name: Clean stale release assets
|
| 77 |
+
continue-on-error: true
|
| 78 |
+
run: |
|
| 79 |
+
TAG="${{ inputs.tag || github.ref_name }}"
|
| 80 |
+
ASSETS=$(gh release view "$TAG" --json assets -q '.assets[].name' 2>/dev/null || echo "")
|
| 81 |
+
[ -z "$ASSETS" ] && exit 0
|
| 82 |
+
|
| 83 |
+
case "${{ matrix.platform }}" in
|
| 84 |
+
mac) PATTERN="${{ matrix.arch }}" ;;
|
| 85 |
+
win) PATTERN="(Setup|\.exe|\.nsis|win)" ;;
|
| 86 |
+
linux) PATTERN="(AppImage|linux)" ;;
|
| 87 |
+
esac
|
| 88 |
+
|
| 89 |
+
echo "$ASSETS" | grep -iE "$PATTERN" | while read -r name; do
|
| 90 |
+
echo "Removing stale asset: $name"
|
| 91 |
+
gh release delete-asset "$TAG" "$name" -y 2>/dev/null || true
|
| 92 |
+
done
|
| 93 |
+
env:
|
| 94 |
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 95 |
+
|
| 96 |
- name: Pack (${{ matrix.platform }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }})
|
| 97 |
working-directory: packages/electron
|
| 98 |
run: npx electron-builder --config electron-builder.yml --${{ matrix.platform }} ${{ matrix.arch && format('--{0}', matrix.arch) || '' }} --publish always
|
| 99 |
env:
|
| 100 |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 101 |
|
| 102 |
+
# macOS x64 runs AFTER arm64 to avoid release asset upload collisions
|
| 103 |
+
# (shared files like latest-mac.yml don't include arch in the name)
|
| 104 |
+
build-mac-x64:
|
| 105 |
needs: build
|
| 106 |
+
runs-on: macos-latest
|
| 107 |
+
|
| 108 |
+
steps:
|
| 109 |
+
- name: Checkout
|
| 110 |
+
uses: actions/checkout@v4
|
| 111 |
+
with:
|
| 112 |
+
ref: ${{ inputs.tag || github.ref }}
|
| 113 |
+
|
| 114 |
+
- name: Setup Node.js
|
| 115 |
+
uses: actions/setup-node@v4
|
| 116 |
+
with:
|
| 117 |
+
node-version: 20
|
| 118 |
+
cache: npm
|
| 119 |
+
|
| 120 |
+
- name: Install all workspace dependencies
|
| 121 |
+
run: npm ci --ignore-scripts
|
| 122 |
+
|
| 123 |
+
- name: Setup curl-impersonate
|
| 124 |
+
run: npx tsx scripts/setup-curl.ts --arch x64
|
| 125 |
+
env:
|
| 126 |
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 127 |
+
|
| 128 |
+
- name: Install web frontend dependencies
|
| 129 |
+
run: cd web && npm ci
|
| 130 |
+
|
| 131 |
+
- name: Install desktop frontend dependencies
|
| 132 |
+
run: cd packages/electron/desktop && npm ci
|
| 133 |
+
|
| 134 |
+
- name: Build core (web + tsc)
|
| 135 |
+
run: npm run build
|
| 136 |
+
|
| 137 |
+
- name: Build desktop frontend
|
| 138 |
+
run: cd packages/electron/desktop && npx vite build
|
| 139 |
+
|
| 140 |
+
- name: Bundle Electron (esbuild)
|
| 141 |
+
working-directory: packages/electron
|
| 142 |
+
run: node electron/build.mjs
|
| 143 |
+
|
| 144 |
+
- name: Prepare pack (copy root resources)
|
| 145 |
+
working-directory: packages/electron
|
| 146 |
+
run: node electron/prepare-pack.mjs
|
| 147 |
+
|
| 148 |
+
- name: Clean stale release assets
|
| 149 |
+
continue-on-error: true
|
| 150 |
+
run: |
|
| 151 |
+
TAG="${{ inputs.tag || github.ref_name }}"
|
| 152 |
+
ASSETS=$(gh release view "$TAG" --json assets -q '.assets[].name' 2>/dev/null || echo "")
|
| 153 |
+
[ -z "$ASSETS" ] && exit 0
|
| 154 |
+
echo "$ASSETS" | grep -iE "x64" | while read -r name; do
|
| 155 |
+
echo "Removing stale asset: $name"
|
| 156 |
+
gh release delete-asset "$TAG" "$name" -y 2>/dev/null || true
|
| 157 |
+
done
|
| 158 |
+
env:
|
| 159 |
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 160 |
+
|
| 161 |
+
- name: Pack (mac-x64)
|
| 162 |
+
working-directory: packages/electron
|
| 163 |
+
run: npx electron-builder --config electron-builder.yml --mac --x64 --publish always
|
| 164 |
+
env:
|
| 165 |
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
| 166 |
+
|
| 167 |
+
release:
|
| 168 |
+
needs: [build, build-mac-x64]
|
| 169 |
runs-on: ubuntu-latest
|
| 170 |
if: startsWith(github.ref, 'refs/tags/v') || inputs.tag
|
| 171 |
|