mirror of
https://github.com/different-ai/openwork
synced 2026-04-25 17:15:34 +02:00
* refactor(repo): move OpenWork apps into apps and ee layout Rebase the monorepo layout migration onto the latest dev changes so the moved app, desktop, share, and cloud surfaces keep working from their new paths. Carry the latest deeplink, token persistence, build, Vercel, and docs updates forward to avoid stale references and broken deploy tooling. * chore(repo): drop generated desktop artifacts Ignore the moved Tauri target and sidecar paths so local cargo checks do not pollute the branch. Remove the accidentally committed outputs from the repo while keeping the layout migration intact. * fix(release): drop built server cli artifact Stop tracking the locally built apps/server/cli binary so generated server outputs do not leak into commits. Also update the release workflow to check the published scoped package name for @openwork/server before deciding whether npm publish is needed. * fix(workspace): add stable CLI bin wrappers Point the server and router package bins at committed wrapper scripts so workspace installs can create shims before dist outputs exist. Keep the wrappers compatible with built binaries and source checkouts to avoid Vercel install warnings without changing runtime behavior.
192 lines
6.9 KiB
YAML
192 lines
6.9 KiB
YAML
name: Alpha Desktop Artifact (macOS arm64)
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: alpha-macos-aarch64-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build-alpha-macos-aarch64:
|
|
name: Build alpha artifact (aarch64-apple-darwin)
|
|
runs-on: macos-14
|
|
timeout-minutes: 180
|
|
|
|
env:
|
|
OPENCODE_GITHUB_REPO: ${{ vars.OPENCODE_GITHUB_REPO || 'anomalyco/opencode' }}
|
|
OPENCODE_VERSION: ${{ vars.OPENCODE_VERSION || '1.2.20' }}
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.sha }}
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Setup pnpm
|
|
uses: pnpm/action-setup@v4
|
|
with:
|
|
version: 10.27.0
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v1
|
|
with:
|
|
bun-version: "1.3.6"
|
|
|
|
- name: Get pnpm store path
|
|
id: pnpm-store
|
|
shell: bash
|
|
run: echo "path=$(pnpm store path --silent)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Cache pnpm store
|
|
uses: actions/cache@v4
|
|
continue-on-error: true
|
|
with:
|
|
path: ${{ steps.pnpm-store.outputs.path }}
|
|
key: macos-pnpm-${{ hashFiles('pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
macos-pnpm-
|
|
|
|
- name: Cache cargo
|
|
uses: actions/cache@v4
|
|
continue-on-error: true
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
apps/desktop/src-tauri/target
|
|
key: macos-cargo-${{ hashFiles('apps/desktop/src-tauri/Cargo.lock') }}
|
|
restore-keys: |
|
|
macos-cargo-
|
|
|
|
- name: Install dependencies
|
|
run: pnpm install --frozen-lockfile --prefer-offline
|
|
|
|
- name: Create CI Tauri config (no updater artifacts)
|
|
run: |
|
|
node -e "const fs=require('fs'); const configPath='apps/desktop/src-tauri/tauri.conf.json'; const ciPath='apps/desktop/src-tauri/tauri.conf.alpha.json'; const config=JSON.parse(fs.readFileSync(configPath,'utf8')); config.bundle={...config.bundle, createUpdaterArtifacts:false}; fs.writeFileSync(ciPath, JSON.stringify(config, null, 2));"
|
|
|
|
- name: Setup Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: aarch64-apple-darwin
|
|
|
|
- name: Resolve OpenCode version
|
|
id: opencode-version
|
|
shell: bash
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
run: |
|
|
node <<'NODE' >> "$GITHUB_OUTPUT"
|
|
const fs = require('fs');
|
|
const repo = (process.env.OPENCODE_GITHUB_REPO || 'anomalyco/opencode').trim() || 'anomalyco/opencode';
|
|
|
|
async function resolveLatest() {
|
|
const token = (process.env.GITHUB_TOKEN || '').trim();
|
|
const headers = {
|
|
Accept: 'application/vnd.github+json',
|
|
'X-GitHub-Api-Version': '2022-11-28',
|
|
'User-Agent': 'openwork-ci',
|
|
};
|
|
if (token) headers.Authorization = `Bearer ${token}`;
|
|
|
|
try {
|
|
const res = await fetch(`https://api.github.com/repos/${repo}/releases/latest`, { headers });
|
|
if (res.ok) {
|
|
const data = await res.json();
|
|
const tag = (typeof data.tag_name === 'string' ? data.tag_name : '').trim();
|
|
const version = (tag.startsWith('v') ? tag.slice(1) : tag).trim();
|
|
if (version) return version;
|
|
}
|
|
if (res.status !== 403) {
|
|
throw new Error(`Failed to resolve latest OpenCode version (HTTP ${res.status})`);
|
|
}
|
|
} catch {
|
|
}
|
|
|
|
const web = await fetch(`https://github.com/${repo}/releases/latest`, {
|
|
headers: { 'User-Agent': 'openwork-ci' },
|
|
redirect: 'follow',
|
|
});
|
|
const url = web && web.url ? String(web.url) : '';
|
|
const match = url.match(/\/tag\/v([^/?#]+)/);
|
|
if (!match) throw new Error('Failed to resolve latest OpenCode version (web redirect).');
|
|
return match[1];
|
|
}
|
|
|
|
async function main() {
|
|
const pkg = JSON.parse(fs.readFileSync('./apps/desktop/package.json', 'utf8'));
|
|
const configuredRaw = (process.env.OPENCODE_VERSION || pkg.opencodeVersion || '').toString().trim();
|
|
if (configuredRaw && configuredRaw.toLowerCase() !== 'latest') {
|
|
const resolved = (configuredRaw.startsWith('v') ? configuredRaw.slice(1) : configuredRaw).trim();
|
|
if (process.env.GITHUB_ENV) {
|
|
fs.appendFileSync(process.env.GITHUB_ENV, `OPENCODE_VERSION=${resolved}\n`);
|
|
}
|
|
console.log('version=' + resolved);
|
|
return;
|
|
}
|
|
const latest = await resolveLatest();
|
|
if (process.env.GITHUB_ENV) {
|
|
fs.appendFileSync(process.env.GITHUB_ENV, `OPENCODE_VERSION=${latest}\n`);
|
|
}
|
|
console.log('version=' + latest);
|
|
}
|
|
|
|
main().catch((err) => {
|
|
console.error(err);
|
|
process.exit(1);
|
|
});
|
|
NODE
|
|
|
|
- name: Download OpenCode sidecar
|
|
shell: bash
|
|
env:
|
|
OPENCODE_VERSION: ${{ steps.opencode-version.outputs.version }}
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
repo="${OPENCODE_GITHUB_REPO:-anomalyco/opencode}"
|
|
opencode_asset="opencode-darwin-arm64.zip"
|
|
url="https://github.com/${repo}/releases/download/v${OPENCODE_VERSION}/${opencode_asset}"
|
|
tmp_dir="$RUNNER_TEMP/opencode"
|
|
extract_dir="$tmp_dir/extracted"
|
|
rm -rf "$tmp_dir"
|
|
mkdir -p "$extract_dir"
|
|
curl -fsSL --retry 5 --retry-all-errors --retry-delay 2 -o "$tmp_dir/$opencode_asset" "$url"
|
|
unzip -q "$tmp_dir/$opencode_asset" -d "$extract_dir"
|
|
|
|
if [ ! -f "$extract_dir/opencode" ]; then
|
|
echo "OpenCode binary not found in archive" >&2
|
|
ls -la "$extract_dir"
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p apps/desktop/src-tauri/sidecars
|
|
cp "$extract_dir/opencode" "apps/desktop/src-tauri/sidecars/opencode-aarch64-apple-darwin"
|
|
chmod 755 "apps/desktop/src-tauri/sidecars/opencode-aarch64-apple-darwin"
|
|
|
|
- name: Build alpha desktop app
|
|
run: pnpm --filter @openwork/desktop exec tauri build --config src-tauri/tauri.conf.alpha.json --target aarch64-apple-darwin --bundles dmg,app
|
|
|
|
- name: Upload alpha artifact bundle
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: openwork-alpha-macos-aarch64-${{ github.sha }}
|
|
path: |
|
|
apps/desktop/src-tauri/target/aarch64-apple-darwin/release/bundle/dmg/*.dmg
|
|
apps/desktop/src-tauri/target/aarch64-apple-darwin/release/bundle/macos/*.app.tar.gz
|
|
apps/desktop/src-tauri/target/aarch64-apple-darwin/release/bundle/macos/*.app.tar.gz.sig
|
|
if-no-files-found: error
|
|
retention-days: 14
|