Compare commits
3 Commits
dev
...
brendan/de
| Author | SHA1 | Date |
|---|---|---|
|
|
13e89deed2 | |
|
|
35717c4b7f | |
|
|
49d63d457c |
|
|
@ -102,150 +102,6 @@ jobs:
|
||||||
outputs:
|
outputs:
|
||||||
version: ${{ needs.version.outputs.version }}
|
version: ${{ needs.version.outputs.version }}
|
||||||
|
|
||||||
build-tauri:
|
|
||||||
needs:
|
|
||||||
- build-cli
|
|
||||||
- version
|
|
||||||
continue-on-error: false
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
settings:
|
|
||||||
- host: macos-latest
|
|
||||||
target: x86_64-apple-darwin
|
|
||||||
- host: macos-latest
|
|
||||||
target: aarch64-apple-darwin
|
|
||||||
# github-hosted: blacksmith lacks ARM64 MSVC cross-compilation toolchain
|
|
||||||
- host: windows-2025
|
|
||||||
target: aarch64-pc-windows-msvc
|
|
||||||
- host: blacksmith-4vcpu-windows-2025
|
|
||||||
target: x86_64-pc-windows-msvc
|
|
||||||
- host: blacksmith-4vcpu-ubuntu-2404
|
|
||||||
target: x86_64-unknown-linux-gnu
|
|
||||||
- host: blacksmith-8vcpu-ubuntu-2404-arm
|
|
||||||
target: aarch64-unknown-linux-gnu
|
|
||||||
runs-on: ${{ matrix.settings.host }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-tags: true
|
|
||||||
|
|
||||||
- uses: apple-actions/import-codesign-certs@v2
|
|
||||||
if: ${{ runner.os == 'macOS' }}
|
|
||||||
with:
|
|
||||||
keychain: build
|
|
||||||
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
|
|
||||||
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Verify Certificate
|
|
||||||
if: ${{ runner.os == 'macOS' }}
|
|
||||||
run: |
|
|
||||||
CERT_INFO=$(security find-identity -v -p codesigning build.keychain | grep "Developer ID Application")
|
|
||||||
CERT_ID=$(echo "$CERT_INFO" | awk -F'"' '{print $2}')
|
|
||||||
echo "CERT_ID=$CERT_ID" >> $GITHUB_ENV
|
|
||||||
echo "Certificate imported."
|
|
||||||
|
|
||||||
- name: Setup Apple API Key
|
|
||||||
if: ${{ runner.os == 'macOS' }}
|
|
||||||
run: |
|
|
||||||
echo "${{ secrets.APPLE_API_KEY_PATH }}" > $RUNNER_TEMP/apple-api-key.p8
|
|
||||||
|
|
||||||
- uses: ./.github/actions/setup-bun
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "24"
|
|
||||||
|
|
||||||
- name: Cache apt packages
|
|
||||||
if: contains(matrix.settings.host, 'ubuntu')
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/apt-cache
|
|
||||||
key: ${{ runner.os }}-${{ matrix.settings.target }}-apt-${{ hashFiles('.github/workflows/publish.yml') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-${{ matrix.settings.target }}-apt-
|
|
||||||
|
|
||||||
- name: install dependencies (ubuntu only)
|
|
||||||
if: contains(matrix.settings.host, 'ubuntu')
|
|
||||||
run: |
|
|
||||||
mkdir -p ~/apt-cache && chmod -R a+rw ~/apt-cache
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y --no-install-recommends -o dir::cache::archives="$HOME/apt-cache" libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
|
|
||||||
sudo chmod -R a+rw ~/apt-cache
|
|
||||||
|
|
||||||
- name: install Rust stable
|
|
||||||
uses: dtolnay/rust-toolchain@stable
|
|
||||||
with:
|
|
||||||
targets: ${{ matrix.settings.target }}
|
|
||||||
|
|
||||||
- uses: Swatinem/rust-cache@v2
|
|
||||||
with:
|
|
||||||
workspaces: packages/desktop/src-tauri
|
|
||||||
shared-key: ${{ matrix.settings.target }}
|
|
||||||
|
|
||||||
- name: Prepare
|
|
||||||
run: |
|
|
||||||
cd packages/desktop
|
|
||||||
bun ./scripts/prepare.ts
|
|
||||||
env:
|
|
||||||
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
|
|
||||||
GITHUB_TOKEN: ${{ steps.committer.outputs.token }}
|
|
||||||
RUST_TARGET: ${{ matrix.settings.target }}
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
GITHUB_RUN_ID: ${{ github.run_id }}
|
|
||||||
|
|
||||||
- name: Resolve tauri portable SHA
|
|
||||||
if: contains(matrix.settings.host, 'ubuntu')
|
|
||||||
run: echo "TAURI_PORTABLE_SHA=$(git ls-remote https://github.com/tauri-apps/tauri.git refs/heads/feat/truly-portable-appimage | cut -f1)" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
# Fixes AppImage build issues, can be removed when https://github.com/tauri-apps/tauri/pull/12491 is released
|
|
||||||
- name: Install tauri-cli from portable appimage branch
|
|
||||||
uses: taiki-e/cache-cargo-install-action@v3
|
|
||||||
if: contains(matrix.settings.host, 'ubuntu')
|
|
||||||
with:
|
|
||||||
tool: tauri-cli
|
|
||||||
git: https://github.com/tauri-apps/tauri
|
|
||||||
# branch: feat/truly-portable-appimage
|
|
||||||
rev: ${{ env.TAURI_PORTABLE_SHA }}
|
|
||||||
|
|
||||||
- name: Show tauri-cli version
|
|
||||||
if: contains(matrix.settings.host, 'ubuntu')
|
|
||||||
run: cargo tauri --version
|
|
||||||
|
|
||||||
- name: Setup git committer
|
|
||||||
id: committer
|
|
||||||
uses: ./.github/actions/setup-git-committer
|
|
||||||
with:
|
|
||||||
opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
|
|
||||||
opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
|
|
||||||
|
|
||||||
- name: Build and upload artifacts
|
|
||||||
uses: tauri-apps/tauri-action@390cbe447412ced1303d35abe75287949e43437a
|
|
||||||
timeout-minutes: 60
|
|
||||||
with:
|
|
||||||
projectPath: packages/desktop
|
|
||||||
uploadWorkflowArtifacts: true
|
|
||||||
tauriScript: ${{ (contains(matrix.settings.host, 'ubuntu') && 'cargo tauri') || '' }}
|
|
||||||
args: --target ${{ matrix.settings.target }} --config ${{ (github.ref_name == 'beta' && './src-tauri/tauri.beta.conf.json') || './src-tauri/tauri.prod.conf.json' }} --verbose
|
|
||||||
updaterJsonPreferNsis: true
|
|
||||||
releaseId: ${{ needs.version.outputs.release }}
|
|
||||||
tagName: ${{ needs.version.outputs.tag }}
|
|
||||||
releaseDraft: true
|
|
||||||
releaseAssetNamePattern: opencode-desktop-[platform]-[arch][ext]
|
|
||||||
repo: ${{ (github.ref_name == 'beta' && 'opencode-beta') || '' }}
|
|
||||||
releaseCommitish: ${{ github.sha }}
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ steps.committer.outputs.token }}
|
|
||||||
TAURI_BUNDLER_NEW_APPIMAGE_FORMAT: true
|
|
||||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
|
||||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
|
||||||
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
|
||||||
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
|
||||||
APPLE_SIGNING_IDENTITY: ${{ env.CERT_ID }}
|
|
||||||
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
|
|
||||||
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
|
|
||||||
APPLE_API_KEY_PATH: ${{ runner.temp }}/apple-api-key.p8
|
|
||||||
|
|
||||||
build-electron:
|
build-electron:
|
||||||
needs:
|
needs:
|
||||||
- build-cli
|
- build-cli
|
||||||
|
|
@ -360,7 +216,7 @@ jobs:
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: opencode-electron-${{ matrix.settings.target }}
|
name: opencode-desktop-${{ matrix.settings.target }}
|
||||||
path: packages/desktop-electron/dist/*
|
path: packages/desktop-electron/dist/*
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
|
|
@ -373,7 +229,6 @@ jobs:
|
||||||
needs:
|
needs:
|
||||||
- version
|
- version
|
||||||
- build-cli
|
- build-cli
|
||||||
- build-tauri
|
|
||||||
- build-electron
|
- build-electron
|
||||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -445,3 +300,5 @@ jobs:
|
||||||
GH_REPO: ${{ needs.version.outputs.repo }}
|
GH_REPO: ${{ needs.version.outputs.repo }}
|
||||||
NPM_CONFIG_PROVENANCE: false
|
NPM_CONFIG_PROVENANCE: false
|
||||||
LATEST_YML_DIR: /tmp/latest-yml
|
LATEST_YML_DIR: /tmp/latest-yml
|
||||||
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||||
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ const channel = (() => {
|
||||||
})()
|
})()
|
||||||
|
|
||||||
const getBase = (): Configuration => ({
|
const getBase = (): Configuration => ({
|
||||||
artifactName: "opencode-electron-${os}-${arch}.${ext}",
|
artifactName: "opencode-desktop-${os}-${arch}.${ext}",
|
||||||
directories: {
|
directories: {
|
||||||
output: "dist",
|
output: "dist",
|
||||||
buildResources: "resources",
|
buildResources: "resources",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
#!/usr/bin/env bun
|
#!/usr/bin/env bun
|
||||||
|
|
||||||
import { Buffer } from "node:buffer"
|
|
||||||
import { $ } from "bun"
|
import { $ } from "bun"
|
||||||
|
import path from "node:path"
|
||||||
|
import { parseArgs } from "node:util"
|
||||||
|
|
||||||
const { values } = parseArgs({
|
const { values } = parseArgs({
|
||||||
args: Bun.argv.slice(2),
|
args: Bun.argv.slice(2),
|
||||||
|
|
@ -12,145 +13,193 @@ const { values } = parseArgs({
|
||||||
|
|
||||||
const dryRun = values["dry-run"]
|
const dryRun = values["dry-run"]
|
||||||
|
|
||||||
import { parseArgs } from "node:util"
|
|
||||||
|
|
||||||
const repo = process.env.GH_REPO
|
const repo = process.env.GH_REPO
|
||||||
if (!repo) throw new Error("GH_REPO is required")
|
if (!repo) throw new Error("GH_REPO is required")
|
||||||
|
|
||||||
const releaseId = process.env.OPENCODE_RELEASE
|
|
||||||
if (!releaseId) throw new Error("OPENCODE_RELEASE is required")
|
|
||||||
|
|
||||||
const version = process.env.OPENCODE_VERSION
|
const version = process.env.OPENCODE_VERSION
|
||||||
if (!releaseId) throw new Error("OPENCODE_VERSION is required")
|
if (!version) throw new Error("OPENCODE_VERSION is required")
|
||||||
|
|
||||||
|
const dir = process.env.LATEST_YML_DIR
|
||||||
|
if (!dir) throw new Error("LATEST_YML_DIR is required")
|
||||||
|
const root = dir
|
||||||
|
|
||||||
const token = process.env.GH_TOKEN ?? process.env.GITHUB_TOKEN
|
const token = process.env.GH_TOKEN ?? process.env.GITHUB_TOKEN
|
||||||
if (!token) throw new Error("GH_TOKEN or GITHUB_TOKEN is required")
|
if (!token) throw new Error("GH_TOKEN or GITHUB_TOKEN is required")
|
||||||
|
|
||||||
const apiHeaders = {
|
|
||||||
Authorization: `token ${token}`,
|
|
||||||
Accept: "application/vnd.github+json",
|
|
||||||
}
|
|
||||||
|
|
||||||
const releaseRes = await fetch(`https://api.github.com/repos/${repo}/releases/${releaseId}`, {
|
|
||||||
headers: apiHeaders,
|
|
||||||
})
|
|
||||||
|
|
||||||
if (!releaseRes.ok) {
|
|
||||||
throw new Error(`Failed to fetch release: ${releaseRes.status} ${releaseRes.statusText}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
type Asset = {
|
type Asset = {
|
||||||
name: string
|
name: string
|
||||||
url: string
|
url: string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Release = {
|
type Release = {
|
||||||
tag_name?: string
|
|
||||||
assets?: Asset[]
|
assets?: Asset[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const release = (await releaseRes.json()) as Release
|
const rel = await fetch(`https://api.github.com/repos/${repo}/releases/tags/v${version}`, {
|
||||||
const assets = release.assets ?? []
|
|
||||||
const assetByName = new Map(assets.map((asset) => [asset.name, asset]))
|
|
||||||
|
|
||||||
const latestAsset = assetByName.get("latest.json")
|
|
||||||
if (!latestAsset) throw new Error("latest.json asset not found")
|
|
||||||
|
|
||||||
const latestRes = await fetch(latestAsset.url, {
|
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `token ${token}`,
|
Authorization: `token ${token}`,
|
||||||
Accept: "application/octet-stream",
|
Accept: "application/vnd.github+json",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
if (!rel.ok) throw new Error(`Failed to fetch release: ${rel.status} ${rel.statusText}`)
|
||||||
|
|
||||||
if (!latestRes.ok) {
|
const assets = ((await rel.json()) as Release).assets ?? []
|
||||||
throw new Error(`Failed to fetch latest.json: ${latestRes.status} ${latestRes.statusText}`)
|
const amap = new Map(assets.map((item) => [item.name, item]))
|
||||||
|
|
||||||
|
type Item = {
|
||||||
|
url: string
|
||||||
}
|
}
|
||||||
|
|
||||||
const latestText = new TextDecoder().decode(await latestRes.arrayBuffer())
|
type Yml = {
|
||||||
const latest = JSON.parse(latestText)
|
version: string
|
||||||
const base = { ...latest }
|
files: Item[]
|
||||||
delete base.platforms
|
}
|
||||||
|
|
||||||
const fetchSignature = async (asset: Asset) => {
|
function parse(text: string): Yml {
|
||||||
const res = await fetch(asset.url, {
|
const lines = text.split("\n")
|
||||||
|
let version = ""
|
||||||
|
const files: Item[] = []
|
||||||
|
let url = ""
|
||||||
|
|
||||||
|
const flush = () => {
|
||||||
|
if (!url) return
|
||||||
|
files.push({ url })
|
||||||
|
url = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const line of lines) {
|
||||||
|
const trim = line.trim()
|
||||||
|
if (line.startsWith("version:")) {
|
||||||
|
version = line.slice("version:".length).trim()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if (trim.startsWith("- url:")) {
|
||||||
|
flush()
|
||||||
|
url = trim.slice("- url:".length).trim()
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
const indented = line.startsWith(" ") || line.startsWith("\t")
|
||||||
|
if (!indented) flush()
|
||||||
|
}
|
||||||
|
flush()
|
||||||
|
|
||||||
|
return { version, files }
|
||||||
|
}
|
||||||
|
|
||||||
|
async function read(sub: string, file: string) {
|
||||||
|
const item = Bun.file(path.join(root, sub, file))
|
||||||
|
if (!(await item.exists())) return undefined
|
||||||
|
return parse(await item.text())
|
||||||
|
}
|
||||||
|
|
||||||
|
function pick(list: Item[], exts: string[]) {
|
||||||
|
for (const ext of exts) {
|
||||||
|
const found = list.find((item) => item.url.split("?")[0]?.toLowerCase().endsWith(ext))
|
||||||
|
if (found) return found.url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function link(raw: string) {
|
||||||
|
if (raw.startsWith("https://") || raw.startsWith("http://")) return raw
|
||||||
|
return `https://github.com/${repo}/releases/download/v${version}/${raw}`
|
||||||
|
}
|
||||||
|
|
||||||
|
function lkey(arch: string, raw: string | undefined) {
|
||||||
|
if (!raw) return
|
||||||
|
const low = raw.split("?")[0]?.toLowerCase() ?? ""
|
||||||
|
if (low.endsWith(".deb")) return `linux-${arch}-deb`
|
||||||
|
if (low.endsWith(".rpm")) return `linux-${arch}-rpm`
|
||||||
|
if (low.endsWith(".appimage")) return `linux-${arch}-appimage`
|
||||||
|
}
|
||||||
|
|
||||||
|
async function sign(url: string, key: string) {
|
||||||
|
const name = decodeURIComponent(new URL(url).pathname.split("/").pop() ?? key)
|
||||||
|
const asset = amap.get(name)
|
||||||
|
const res = await fetch(asset?.url ?? url, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `token ${token}`,
|
Authorization: `token ${token}`,
|
||||||
Accept: "application/octet-stream",
|
...(asset ? { Accept: "application/octet-stream" } : {}),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
throw new Error(`Failed to fetch signature: ${res.status} ${res.statusText}`)
|
throw new Error(`Failed to fetch file ${name}: ${res.status} ${res.statusText} (${asset?.url ?? url})`)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Buffer.from(await res.arrayBuffer()).toString()
|
const tmp = process.env.RUNNER_TEMP ?? "/tmp"
|
||||||
|
const file = path.join(tmp, name)
|
||||||
|
await Bun.write(file, await res.arrayBuffer())
|
||||||
|
const out = await $`bunx @tauri-apps/cli signer sign ${file}`.text()
|
||||||
|
return out.trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
const entries: Record<string, { url: string; signature: string }> = {}
|
const add = async (data: Record<string, { url: string; signature: string }>, key: string, raw: string | undefined) => {
|
||||||
const add = (key: string, asset: Asset, signature: string) => {
|
if (!raw) return
|
||||||
if (entries[key]) return
|
if (data[key]) return
|
||||||
entries[key] = {
|
const url = link(raw)
|
||||||
url: `https://github.com/${repo}/releases/download/v${version}/${asset.name}`,
|
data[key] = { url, signature: await sign(url, key) }
|
||||||
signature,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const targets = [
|
const alias = (data: Record<string, { url: string; signature: string }>, key: string, src: string) => {
|
||||||
{ key: "linux-x86_64-deb", asset: "opencode-desktop-linux-amd64.deb" },
|
if (data[key]) return
|
||||||
{ key: "linux-x86_64-rpm", asset: "opencode-desktop-linux-x86_64.rpm" },
|
if (!data[src]) return
|
||||||
{ key: "linux-aarch64-deb", asset: "opencode-desktop-linux-arm64.deb" },
|
data[key] = data[src]
|
||||||
{ key: "linux-aarch64-rpm", asset: "opencode-desktop-linux-aarch64.rpm" },
|
|
||||||
{ key: "windows-aarch64-nsis", asset: "opencode-desktop-windows-arm64.exe" },
|
|
||||||
{ key: "windows-x86_64-nsis", asset: "opencode-desktop-windows-x64.exe" },
|
|
||||||
{ key: "darwin-x86_64-app", asset: "opencode-desktop-darwin-x64.app.tar.gz" },
|
|
||||||
{
|
|
||||||
key: "darwin-aarch64-app",
|
|
||||||
asset: "opencode-desktop-darwin-aarch64.app.tar.gz",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
for (const target of targets) {
|
|
||||||
const asset = assetByName.get(target.asset)
|
|
||||||
if (!asset) continue
|
|
||||||
|
|
||||||
const sig = assetByName.get(`${target.asset}.sig`)
|
|
||||||
if (!sig) continue
|
|
||||||
|
|
||||||
const signature = await fetchSignature(sig)
|
|
||||||
add(target.key, asset, signature)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const alias = (key: string, source: string) => {
|
const winx = await read("latest-yml-x86_64-pc-windows-msvc", "latest.yml")
|
||||||
if (entries[key]) return
|
const wina = await read("latest-yml-aarch64-pc-windows-msvc", "latest.yml")
|
||||||
const entry = entries[source]
|
const macx = await read("latest-yml-x86_64-apple-darwin", "latest-mac.yml")
|
||||||
if (!entry) return
|
const maca = await read("latest-yml-aarch64-apple-darwin", "latest-mac.yml")
|
||||||
entries[key] = entry
|
const linx = await read("latest-yml-x86_64-unknown-linux-gnu", "latest-linux.yml")
|
||||||
}
|
const lina = await read("latest-yml-aarch64-unknown-linux-gnu", "latest-linux-arm64.yml")
|
||||||
|
|
||||||
alias("linux-x86_64", "linux-x86_64-deb")
|
const yver = winx?.version ?? wina?.version ?? macx?.version ?? maca?.version ?? linx?.version ?? lina?.version
|
||||||
alias("linux-aarch64", "linux-aarch64-deb")
|
if (yver && yver !== version) throw new Error(`latest.yml version mismatch: expected ${version}, got ${yver}`)
|
||||||
alias("windows-aarch64", "windows-aarch64-nsis")
|
|
||||||
alias("windows-x86_64", "windows-x86_64-nsis")
|
const out: Record<string, { url: string; signature: string }> = {}
|
||||||
alias("darwin-x86_64", "darwin-x86_64-app")
|
|
||||||
alias("darwin-aarch64", "darwin-aarch64-app")
|
const winxexe = pick(winx?.files ?? [], [".exe"])
|
||||||
|
const winaexe = pick(wina?.files ?? [], [".exe"])
|
||||||
|
const macxzip = pick(macx?.files ?? [], [".zip", ".dmg"])
|
||||||
|
const macazip = pick(maca?.files ?? [], [".zip", ".dmg"])
|
||||||
|
const linxapp = pick(linx?.files ?? [], [".appimage", ".deb", ".rpm"])
|
||||||
|
const linaapp = pick(lina?.files ?? [], [".appimage", ".deb", ".rpm"])
|
||||||
|
const linxkey = lkey("x86_64", linxapp)
|
||||||
|
const linakey = lkey("aarch64", linaapp)
|
||||||
|
|
||||||
|
await add(out, "windows-x86_64-nsis", winxexe)
|
||||||
|
await add(out, "windows-aarch64-nsis", winaexe)
|
||||||
|
await add(out, "darwin-x86_64-app", macxzip)
|
||||||
|
await add(out, "darwin-aarch64-app", macazip)
|
||||||
|
if (linxkey) await add(out, linxkey, linxapp)
|
||||||
|
if (linakey) await add(out, linakey, linaapp)
|
||||||
|
|
||||||
|
alias(out, "windows-x86_64", "windows-x86_64-nsis")
|
||||||
|
alias(out, "windows-aarch64", "windows-aarch64-nsis")
|
||||||
|
alias(out, "darwin-x86_64", "darwin-x86_64-app")
|
||||||
|
alias(out, "darwin-aarch64", "darwin-aarch64-app")
|
||||||
|
if (linxkey) alias(out, "linux-x86_64", linxkey)
|
||||||
|
if (linakey) alias(out, "linux-aarch64", linakey)
|
||||||
|
|
||||||
const platforms = Object.fromEntries(
|
const platforms = Object.fromEntries(
|
||||||
Object.keys(entries)
|
Object.keys(out)
|
||||||
.sort()
|
.sort()
|
||||||
.map((key) => [key, entries[key]]),
|
.map((key) => [key, out[key]]),
|
||||||
)
|
)
|
||||||
const output = {
|
|
||||||
...base,
|
if (!Object.keys(platforms).length) throw new Error("No updater files found in latest.yml artifacts")
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
version,
|
||||||
|
notes: "",
|
||||||
|
pub_date: new Date().toISOString(),
|
||||||
platforms,
|
platforms,
|
||||||
}
|
}
|
||||||
|
|
||||||
const dir = process.env.RUNNER_TEMP ?? "/tmp"
|
const tmp = process.env.RUNNER_TEMP ?? "/tmp"
|
||||||
const file = `${dir}/latest.json`
|
const file = path.join(tmp, "latest.json")
|
||||||
await Bun.write(file, JSON.stringify(output, null, 2))
|
await Bun.write(file, JSON.stringify(data, null, 2))
|
||||||
|
|
||||||
const tag = release.tag_name
|
const tag = `v${version}`
|
||||||
if (!tag) throw new Error("Release tag not found")
|
|
||||||
|
|
||||||
if (dryRun) {
|
if (dryRun) {
|
||||||
console.log(`dry-run: wrote latest.json for ${tag} to ${file}`)
|
console.log(`dry-run: wrote latest.json for ${tag} to ${file}`)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue