Skip to content

Commit a3cb00a

Browse files
committed
try improve
1 parent 6a7b415 commit a3cb00a

2 files changed

Lines changed: 45 additions & 20 deletions

File tree

.github/workflows/publish.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,30 @@ jobs:
341341
env:
342342
OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
343343

344+
- name: Create and upload macOS .app.tar.gz
345+
if: runner.os == 'macOS' && needs.version.outputs.release
346+
working-directory: packages/desktop-electron/dist
347+
env:
348+
GH_TOKEN: ${{ steps.committer.outputs.token }}
349+
run: |
350+
if [[ "${{ matrix.settings.target }}" == "x86_64-apple-darwin" ]]; then
351+
APP_DIR="mac"
352+
OUT_NAME="opencode-desktop-darwin-x64.app.tar.gz"
353+
elif [[ "${{ matrix.settings.target }}" == "aarch64-apple-darwin" ]]; then
354+
APP_DIR="mac-arm64"
355+
OUT_NAME="opencode-desktop-darwin-aarch64.app.tar.gz"
356+
else
357+
echo "Unknown macOS target: ${{ matrix.settings.target }}"
358+
exit 1
359+
fi
360+
APP_PATH=$(find "$APP_DIR" -maxdepth 1 -name "*.app" -type d | head -1)
361+
if [ -z "$APP_PATH" ]; then
362+
echo "No .app bundle found in $APP_DIR"
363+
exit 1
364+
fi
365+
tar -czf "$OUT_NAME" -C "$(dirname "$APP_PATH")" "$(basename "$APP_PATH")"
366+
gh release upload "v${{ needs.version.outputs.version }}" "$OUT_NAME" --clobber --repo "${{ needs.version.outputs.repo }}"
367+
344368
- name: Verify signed Windows Electron artifacts
345369
if: runner.os == 'Windows'
346370
shell: pwsh

packages/desktop/scripts/finalize-latest-json.ts

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,6 @@ function link(raw: string) {
110110
return `https://github.com/${repo}/releases/download/v${version}/${raw}`
111111
}
112112

113-
function lkey(arch: string, raw: string | undefined) {
114-
if (!raw) return
115-
const low = raw.split("?")[0]?.toLowerCase() ?? ""
116-
if (low.endsWith(".deb")) return `linux-${arch}-deb`
117-
if (low.endsWith(".rpm")) return `linux-${arch}-rpm`
118-
if (low.endsWith(".appimage")) return `linux-${arch}-appimage`
119-
}
120-
121113
async function sign(url: string, key: string) {
122114
const name = decodeURIComponent(new URL(url).pathname.split("/").pop() ?? key)
123115
const asset = amap.get(name)
@@ -167,26 +159,35 @@ const out: Record<string, { url: string; signature: string }> = {}
167159

168160
const winxexe = pick(winx?.files ?? [], [".exe"])
169161
const winaexe = pick(wina?.files ?? [], [".exe"])
170-
const macxzip = pick(macx?.files ?? [], [".zip", ".dmg"])
171-
const macazip = pick(maca?.files ?? [], [".zip", ".dmg"])
172-
const linxapp = pick(linx?.files ?? [], [".appimage", ".deb", ".rpm"])
173-
const linaapp = pick(lina?.files ?? [], [".appimage", ".deb", ".rpm"])
174-
const linxkey = lkey("x86_64", linxapp)
175-
const linakey = lkey("aarch64", linaapp)
162+
163+
const macxTarGz = "opencode-desktop-darwin-x64.app.tar.gz"
164+
const macaTarGz = "opencode-desktop-darwin-aarch64.app.tar.gz"
165+
166+
const linxDeb = pick(linx?.files ?? [], [".deb"])
167+
const linxRpm = pick(linx?.files ?? [], [".rpm"])
168+
const linxAppImage = pick(linx?.files ?? [], [".appimage"])
169+
const linaDeb = pick(lina?.files ?? [], [".deb"])
170+
const linaRpm = pick(lina?.files ?? [], [".rpm"])
171+
const linaAppImage = pick(lina?.files ?? [], [".appimage"])
176172

177173
await add(out, "windows-x86_64-nsis", winxexe)
178174
await add(out, "windows-aarch64-nsis", winaexe)
179-
await add(out, "darwin-x86_64-app", macxzip)
180-
await add(out, "darwin-aarch64-app", macazip)
181-
if (linxkey) await add(out, linxkey, linxapp)
182-
if (linakey) await add(out, linakey, linaapp)
175+
await add(out, "darwin-x86_64-app", macxTarGz)
176+
await add(out, "darwin-aarch64-app", macaTarGz)
177+
178+
await add(out, "linux-x86_64-deb", linxDeb)
179+
await add(out, "linux-x86_64-rpm", linxRpm)
180+
await add(out, "linux-x86_64-appimage", linxAppImage)
181+
await add(out, "linux-aarch64-deb", linaDeb)
182+
await add(out, "linux-aarch64-rpm", linaRpm)
183+
await add(out, "linux-aarch64-appimage", linaAppImage)
183184

184185
alias(out, "windows-x86_64", "windows-x86_64-nsis")
185186
alias(out, "windows-aarch64", "windows-aarch64-nsis")
186187
alias(out, "darwin-x86_64", "darwin-x86_64-app")
187188
alias(out, "darwin-aarch64", "darwin-aarch64-app")
188-
if (linxkey) alias(out, "linux-x86_64", linxkey)
189-
if (linakey) alias(out, "linux-aarch64", linakey)
189+
alias(out, "linux-x86_64", "linux-x86_64-deb")
190+
alias(out, "linux-aarch64", "linux-aarch64-deb")
190191

191192
const platforms = Object.fromEntries(
192193
Object.keys(out)

0 commit comments

Comments
 (0)