Skip to content

chore: update Tauri opencode config and build script for sidecar #158

chore: update Tauri opencode config and build script for sidecar

chore: update Tauri opencode config and build script for sidecar #158

Workflow file for this run

name: Deploy to Production
on:
push:
branches: [main]
paths-ignore:
- 'docs/**'
- '*.md'
- 'LICENSE'
- 'packaging/**'
- 'apps/landing/**'
- 'apps/intro-video/**'
- 'apps/desktop/**'
- '.gitignore'
- '.opencodeignore'
workflow_dispatch:
concurrency:
group: deploy-production
cancel-in-progress: true
jobs:
checks:
name: Checks
runs-on: ubuntu-latest
timeout-minutes: 10
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: openlinear
POSTGRES_PASSWORD: openlinear
POSTGRES_DB: openlinear_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgresql://openlinear:openlinear@localhost:5432/openlinear_test
TURBO_TELEMETRY_DISABLED: 1
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Generate Prisma client
run: pnpm --filter @openlinear/db db:generate
- name: Push schema to test database
run: pnpm --filter @openlinear/db db:push
- name: Typecheck (API + Desktop UI)
run: pnpm --filter @openlinear/api typecheck && pnpm --filter @openlinear/desktop-ui lint
- name: Build API
run: pnpm --filter @openlinear/api build
- name: Test
run: pnpm --filter @openlinear/api test
timeout-minutes: 5
deploy:
name: Deploy
needs: checks
runs-on: ubuntu-latest
environment: production
timeout-minutes: 10
steps:
- name: Deploy to droplet
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
command_timeout: 15m
script: |
set -e
export CI=true
cd /opt/openlinear && git reset --hard HEAD
/opt/openlinear/scripts/deploy.sh
- name: Diagnostics (pm2 + port + local health)
if: ${{ always() }}
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
command_timeout: 2m
script: |
set -e
echo "== pm2 show =="
pm2 show openlinear-api || true
pm2 show openlinear-fe || true
echo "== port 3001 listener =="
(command -v ss >/dev/null 2>&1 && ss -ltnp | grep ':3001' && exit 0) || true
(command -v lsof >/dev/null 2>&1 && lsof -iTCP:3001 -sTCP:LISTEN -nP && exit 0) || true
echo "== localhost health =="
curl -sS -D- -o /dev/null --max-time 5 http://localhost:3001/health || true
- name: Verify deployment
run: |
for i in 1 2 3 4 5 6; do
HTTP_STATUS=$(curl -s -o /dev/null -w '%{http_code}' https://rixie.in/health)
if [ "$HTTP_STATUS" = "200" ]; then
echo "Deployment verified (HTTP $HTTP_STATUS)"
exit 0
fi
echo "Attempt $i: got $HTTP_STATUS, retrying in 5s..."
sleep 5
done
echo "Health check failed after 6 attempts"
exit 1
auto-tag:
name: Auto Tag & Release
needs: deploy
if: "github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.PAT_TOKEN || secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Bump version and push tag
run: |
TAURI_VER=$(node -p "require('./apps/desktop/src-tauri/tauri.conf.json').version")
NPM_VER=$(node -p "require('./packages/openlinear/package.json').version")
get_latest_version() {
local v1=$1
local v2=$2
if [ "$(printf '%s\n' "$v1" "$v2" | sort -V | tail -n1)" = "$v1" ]; then
echo "$v1"
else
echo "$v2"
fi
}
HIGHEST=$(get_latest_version "$TAURI_VER" "$NPM_VER")
IFS='.' read -ra ADDR <<< "$HIGHEST"
MAJOR="${ADDR[0]}"
MINOR="${ADDR[1]}"
PATCH="${ADDR[2]}"
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
echo "Bumping from $HIGHEST to $NEW_VERSION"
node -e "
const fs = require('fs');
const p = './packages/openlinear/package.json';
const data = JSON.parse(fs.readFileSync(p));
data.version = '$NEW_VERSION';
fs.writeFileSync(p, JSON.stringify(data, null, 2) + '\n');
"
node -e "
const fs = require('fs');
const p = './apps/desktop/src-tauri/tauri.conf.json';
const data = JSON.parse(fs.readFileSync(p));
data.version = '$NEW_VERSION';
fs.writeFileSync(p, JSON.stringify(data, null, 2) + '\n');
"
sed -i "s/^pkgver=.*/pkgver=$NEW_VERSION/" packaging/aur/openlinear-bin/PKGBUILD
sed -i "s/pkgver = .*/pkgver = $NEW_VERSION/" packaging/aur/openlinear-bin/.SRCINFO
sed -i "s/v$HIGHEST/v$NEW_VERSION/g" packaging/aur/openlinear-bin/.SRCINFO
sed -i "s/openlinear-$HIGHEST/openlinear-$NEW_VERSION/g" packaging/aur/openlinear-bin/.SRCINFO
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add apps/desktop/src-tauri/tauri.conf.json packages/openlinear/package.json packaging/aur/openlinear-bin/PKGBUILD packaging/aur/openlinear-bin/.SRCINFO
git commit -m "chore(release): v$NEW_VERSION [skip ci]"
git tag "v$NEW_VERSION"
git push origin main
git push origin "v$NEW_VERSION"