feat: 灵犀 Studio Web UI 定制版
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- base
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: build-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
cache-dependency-path: package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm ci --ignore-scripts
|
||||
npm rebuild node-pty
|
||||
|
||||
- name: Check repository harness
|
||||
run: npm run harness:check
|
||||
|
||||
- name: Test with coverage
|
||||
run: npm run test:coverage
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
@@ -0,0 +1,213 @@
|
||||
name: Manual Desktop Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
target_os:
|
||||
description: "Desktop target OS"
|
||||
required: true
|
||||
type: choice
|
||||
default: win32
|
||||
options:
|
||||
- win32
|
||||
- darwin
|
||||
- linux
|
||||
target_arch:
|
||||
description: "Desktop target architecture"
|
||||
required: true
|
||||
type: choice
|
||||
default: x64
|
||||
options:
|
||||
- x64
|
||||
- arm64
|
||||
release_tag:
|
||||
description: "Optional release tag to attach artifacts to"
|
||||
required: false
|
||||
type: string
|
||||
runtime_release_tag:
|
||||
description: "Optional runtime release tag embedded into the desktop app"
|
||||
required: false
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: desktop-manual-${{ github.event.inputs.target_os }}-${{ github.event.inputs.target_arch }}-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
label: ${{ steps.target.outputs.label }}
|
||||
runner: ${{ steps.target.outputs.runner }}
|
||||
target_os: ${{ steps.target.outputs.target_os }}
|
||||
target_arch: ${{ steps.target.outputs.target_arch }}
|
||||
electron_target: ${{ steps.target.outputs.electron_target }}
|
||||
artifact_name: ${{ steps.target.outputs.artifact_name }}
|
||||
artifact_files: ${{ steps.target.outputs.artifact_files }}
|
||||
steps:
|
||||
- name: Select requested target
|
||||
id: target
|
||||
shell: bash
|
||||
run: |
|
||||
write_common_outputs() {
|
||||
{
|
||||
echo "label=$1"
|
||||
echo "runner=$2"
|
||||
echo "target_os=${{ github.event.inputs.target_os }}"
|
||||
echo "target_arch=${{ github.event.inputs.target_arch }}"
|
||||
echo "electron_target=$3"
|
||||
echo "artifact_name=$4"
|
||||
echo "artifact_files<<EOF"
|
||||
shift 4
|
||||
printf '%s\n' "$@"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
}
|
||||
|
||||
case "${{ github.event.inputs.target_os }}-${{ github.event.inputs.target_arch }}" in
|
||||
win32-x64)
|
||||
write_common_outputs "Windows x64" "windows-latest" "--win nsis --x64" "desktop-win32-x64" \
|
||||
"packages/desktop/release/*.exe" \
|
||||
"packages/desktop/release/*.exe.blockmap" \
|
||||
"packages/desktop/release/latest*.yml"
|
||||
;;
|
||||
darwin-arm64)
|
||||
write_common_outputs "macOS arm64" "macos-14" "--mac dmg zip --arm64" "desktop-darwin-arm64" \
|
||||
"packages/desktop/release/*.dmg" \
|
||||
"packages/desktop/release/*.dmg.blockmap" \
|
||||
"packages/desktop/release/*.zip" \
|
||||
"packages/desktop/release/*.zip.blockmap" \
|
||||
"packages/desktop/release/latest*.yml"
|
||||
;;
|
||||
darwin-x64)
|
||||
write_common_outputs "macOS x64" "macos-15-intel" "--mac dmg zip --x64" "desktop-darwin-x64" \
|
||||
"packages/desktop/release/*.dmg" \
|
||||
"packages/desktop/release/*.dmg.blockmap" \
|
||||
"packages/desktop/release/*.zip" \
|
||||
"packages/desktop/release/*.zip.blockmap" \
|
||||
"packages/desktop/release/latest*.yml"
|
||||
;;
|
||||
linux-x64)
|
||||
write_common_outputs "Linux x64" "ubuntu-22.04" "--linux AppImage deb --x64" "desktop-linux-x64" \
|
||||
"packages/desktop/release/*.AppImage" \
|
||||
"packages/desktop/release/*.deb" \
|
||||
"packages/desktop/release/latest*.yml"
|
||||
;;
|
||||
linux-arm64)
|
||||
write_common_outputs "Linux arm64" "ubuntu-22.04-arm" "--linux AppImage --arm64" "desktop-linux-arm64" \
|
||||
"packages/desktop/release/*.AppImage" \
|
||||
"packages/desktop/release/latest*.yml"
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported desktop target: ${{ github.event.inputs.target_os }} ${{ github.event.inputs.target_arch }}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
desktop:
|
||||
name: Desktop (${{ needs.validate.outputs.label }})
|
||||
needs: validate
|
||||
runs-on: ${{ needs.validate.outputs.runner }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
cache-dependency-path: |
|
||||
package-lock.json
|
||||
packages/desktop/package-lock.json
|
||||
|
||||
- name: Install web UI dependencies
|
||||
run: |
|
||||
npm ci --ignore-scripts
|
||||
npm rebuild node-pty
|
||||
|
||||
- name: Build web UI
|
||||
run: npm run build
|
||||
|
||||
- name: Keep production web UI dependencies only
|
||||
run: npm prune --omit=dev --no-audit --no-fund
|
||||
|
||||
- name: Install desktop dependencies
|
||||
run: npm ci --prefix packages/desktop --no-audit --no-fund
|
||||
|
||||
- name: Write runtime release metadata
|
||||
shell: bash
|
||||
env:
|
||||
RUNTIME_RELEASE_TAG: ${{ github.event.inputs.runtime_release_tag }}
|
||||
run: npm --prefix packages/desktop run write:runtime-release
|
||||
|
||||
- name: Configure macOS signing
|
||||
if: needs.validate.outputs.target_os == 'darwin'
|
||||
shell: bash
|
||||
env:
|
||||
MAC_CSC_LINK: ${{ secrets.MAC_CSC_LINK }}
|
||||
MAC_CSC_KEY_PASSWORD: ${{ secrets.MAC_CSC_KEY_PASSWORD }}
|
||||
MAC_APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||
MAC_APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
|
||||
MAC_APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||
run: |
|
||||
write_env() {
|
||||
local name="$1"
|
||||
local value="$2"
|
||||
if [ -n "$value" ]; then
|
||||
{
|
||||
echo "$name<<EOF"
|
||||
echo "$value"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_ENV"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -z "${MAC_CSC_LINK:-}" ]; then
|
||||
echo "CSC_IDENTITY_AUTO_DISCOVERY=false" >> "$GITHUB_ENV"
|
||||
echo "MAC_BUILD_EXTRA_ARGS=--config.mac.notarize=false" >> "$GITHUB_ENV"
|
||||
echo "No macOS signing certificate configured; building unsigned and skipping notarization."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
write_env "CSC_LINK" "$MAC_CSC_LINK"
|
||||
write_env "CSC_KEY_PASSWORD" "$MAC_CSC_KEY_PASSWORD"
|
||||
|
||||
if [ -n "${MAC_APPLE_ID:-}" ] && [ -n "${MAC_APPLE_APP_SPECIFIC_PASSWORD:-}" ] && [ -n "${MAC_APPLE_TEAM_ID:-}" ]; then
|
||||
write_env "APPLE_ID" "$MAC_APPLE_ID"
|
||||
write_env "APPLE_APP_SPECIFIC_PASSWORD" "$MAC_APPLE_APP_SPECIFIC_PASSWORD"
|
||||
write_env "APPLE_TEAM_ID" "$MAC_APPLE_TEAM_ID"
|
||||
echo "macOS signing and notarization are configured."
|
||||
else
|
||||
echo "MAC_BUILD_EXTRA_ARGS=--config.mac.notarize=false" >> "$GITHUB_ENV"
|
||||
echo "macOS signing certificate configured; Apple notarization credentials incomplete, skipping notarization."
|
||||
fi
|
||||
|
||||
- name: Build desktop artifact
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ needs.validate.outputs.target_os }}" = "darwin" ]; then
|
||||
ulimit -n 10240 || true
|
||||
echo "File descriptor limit: $(ulimit -n)"
|
||||
fi
|
||||
npm --prefix packages/desktop run dist -- ${{ needs.validate.outputs.electron_target }} ${MAC_BUILD_EXTRA_ARGS:-} --publish never
|
||||
|
||||
- name: Upload workflow artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ needs.validate.outputs.artifact_name }}
|
||||
path: ${{ needs.validate.outputs.artifact_files }}
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
|
||||
- name: Upload artifacts to release
|
||||
if: github.event.inputs.release_tag != ''
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.event.inputs.release_tag }}
|
||||
fail_on_unmatched_files: true
|
||||
files: ${{ needs.validate.outputs.artifact_files }}
|
||||
@@ -0,0 +1,206 @@
|
||||
name: Publish Desktop Artifacts to Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Existing release tag to attach artifacts to (e.g. v0.6.5)"
|
||||
required: true
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: desktop-release-${{ github.event.release.tag_name || github.event.inputs.tag || github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
desktop:
|
||||
name: Desktop (${{ matrix.label }})
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- label: macOS arm64
|
||||
runner: macos-14
|
||||
target_os: darwin
|
||||
target_arch: arm64
|
||||
electron_target: "--mac dmg zip --arm64"
|
||||
artifact_files: |
|
||||
packages/desktop/release/*.dmg
|
||||
packages/desktop/release/*.dmg.blockmap
|
||||
packages/desktop/release/*.zip
|
||||
packages/desktop/release/*.zip.blockmap
|
||||
- label: macOS x64
|
||||
runner: macos-15-intel
|
||||
target_os: darwin
|
||||
target_arch: x64
|
||||
electron_target: "--mac dmg zip --x64"
|
||||
artifact_files: |
|
||||
packages/desktop/release/*.dmg
|
||||
packages/desktop/release/*.dmg.blockmap
|
||||
packages/desktop/release/*.zip
|
||||
packages/desktop/release/*.zip.blockmap
|
||||
- label: Windows x64
|
||||
runner: windows-latest
|
||||
target_os: win32
|
||||
target_arch: x64
|
||||
electron_target: "--win nsis --x64"
|
||||
artifact_files: |
|
||||
packages/desktop/release/*.exe
|
||||
packages/desktop/release/*.exe.blockmap
|
||||
packages/desktop/release/latest*.yml
|
||||
- label: Linux x64
|
||||
runner: ubuntu-22.04
|
||||
target_os: linux
|
||||
target_arch: x64
|
||||
electron_target: "--linux AppImage deb --x64"
|
||||
artifact_files: |
|
||||
packages/desktop/release/*.AppImage
|
||||
packages/desktop/release/*.deb
|
||||
packages/desktop/release/latest*.yml
|
||||
- label: Linux arm64
|
||||
runner: ubuntu-22.04-arm
|
||||
target_os: linux
|
||||
target_arch: arm64
|
||||
electron_target: "--linux AppImage --arm64"
|
||||
artifact_files: |
|
||||
packages/desktop/release/*.AppImage
|
||||
packages/desktop/release/latest*.yml
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.release.tag_name || github.event.inputs.tag }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
cache-dependency-path: |
|
||||
package-lock.json
|
||||
packages/desktop/package-lock.json
|
||||
|
||||
- name: Install web UI dependencies
|
||||
run: |
|
||||
npm ci --ignore-scripts
|
||||
npm rebuild node-pty
|
||||
|
||||
- name: Build web UI
|
||||
run: npm run build
|
||||
|
||||
- name: Keep production web UI dependencies only
|
||||
run: npm prune --omit=dev --no-audit --no-fund
|
||||
|
||||
- name: Install desktop dependencies
|
||||
run: npm ci --prefix packages/desktop --no-audit --no-fund
|
||||
|
||||
- name: Write runtime release metadata
|
||||
shell: bash
|
||||
env:
|
||||
HERMES_DESKTOP_RUNTIME_RELEASE_TAG: ${{ vars.HERMES_DESKTOP_RUNTIME_RELEASE_TAG }}
|
||||
run: npm --prefix packages/desktop run write:runtime-release
|
||||
|
||||
- name: Configure macOS signing
|
||||
if: matrix.target_os == 'darwin'
|
||||
shell: bash
|
||||
env:
|
||||
MAC_CSC_LINK: ${{ secrets.MAC_CSC_LINK }}
|
||||
MAC_CSC_KEY_PASSWORD: ${{ secrets.MAC_CSC_KEY_PASSWORD }}
|
||||
MAC_APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||
MAC_APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
|
||||
MAC_APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||
run: |
|
||||
write_env() {
|
||||
local name="$1"
|
||||
local value="$2"
|
||||
if [ -n "$value" ]; then
|
||||
{
|
||||
echo "$name<<EOF"
|
||||
echo "$value"
|
||||
echo "EOF"
|
||||
} >> "$GITHUB_ENV"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -z "${MAC_CSC_LINK:-}" ]; then
|
||||
echo "CSC_IDENTITY_AUTO_DISCOVERY=false" >> "$GITHUB_ENV"
|
||||
echo "MAC_BUILD_EXTRA_ARGS=--config.mac.notarize=false" >> "$GITHUB_ENV"
|
||||
echo "No macOS signing certificate configured; building unsigned and skipping notarization."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
write_env "CSC_LINK" "$MAC_CSC_LINK"
|
||||
write_env "CSC_KEY_PASSWORD" "$MAC_CSC_KEY_PASSWORD"
|
||||
|
||||
if [ -n "${MAC_APPLE_ID:-}" ] && [ -n "${MAC_APPLE_APP_SPECIFIC_PASSWORD:-}" ] && [ -n "${MAC_APPLE_TEAM_ID:-}" ]; then
|
||||
write_env "APPLE_ID" "$MAC_APPLE_ID"
|
||||
write_env "APPLE_APP_SPECIFIC_PASSWORD" "$MAC_APPLE_APP_SPECIFIC_PASSWORD"
|
||||
write_env "APPLE_TEAM_ID" "$MAC_APPLE_TEAM_ID"
|
||||
echo "macOS signing and notarization are configured."
|
||||
else
|
||||
echo "MAC_BUILD_EXTRA_ARGS=--config.mac.notarize=false" >> "$GITHUB_ENV"
|
||||
echo "macOS signing certificate configured; Apple notarization credentials incomplete, skipping notarization."
|
||||
fi
|
||||
|
||||
- name: Build desktop artifact
|
||||
shell: bash
|
||||
run: |
|
||||
if [ "${{ matrix.target_os }}" = "darwin" ]; then
|
||||
ulimit -n 10240 || true
|
||||
echo "File descriptor limit: $(ulimit -n)"
|
||||
fi
|
||||
npm --prefix packages/desktop run dist -- ${{ matrix.electron_target }} ${MAC_BUILD_EXTRA_ARGS:-} --publish never
|
||||
|
||||
- name: Upload macOS update manifest artifact
|
||||
if: matrix.target_os == 'darwin'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: latest-mac-${{ matrix.target_arch }}
|
||||
path: packages/desktop/release/latest-mac.yml
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
|
||||
- name: Upload artifacts to release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.event.release.tag_name || github.event.inputs.tag }}
|
||||
fail_on_unmatched_files: true
|
||||
files: ${{ matrix.artifact_files }}
|
||||
|
||||
mac-update-manifest:
|
||||
name: Merge macOS updater manifest
|
||||
needs: desktop
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.release.tag_name || github.event.inputs.tag }}
|
||||
|
||||
- name: Download macOS update manifests
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: latest-mac-*
|
||||
path: /tmp/hermes-mac-manifests
|
||||
merge-multiple: false
|
||||
|
||||
- name: Merge macOS update manifests
|
||||
shell: bash
|
||||
run: |
|
||||
node packages/desktop/scripts/merge-mac-latest-yml.mjs \
|
||||
/tmp/hermes-mac-manifests/latest-mac-arm64/latest-mac.yml \
|
||||
/tmp/hermes-mac-manifests/latest-mac-x64/latest-mac.yml \
|
||||
> /tmp/latest-mac.yml
|
||||
|
||||
- name: Upload merged macOS updater manifest to release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.event.release.tag_name || github.event.inputs.tag }}
|
||||
fail_on_unmatched_files: true
|
||||
files: /tmp/latest-mac.yml
|
||||
@@ -0,0 +1,125 @@
|
||||
name: Publish Desktop Runtime to Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: "Existing release tag to attach runtime assets to"
|
||||
required: true
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
concurrency:
|
||||
group: desktop-runtime-${{ github.event.release.tag_name || github.event.inputs.tag || github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
runtime:
|
||||
name: Runtime (${{ matrix.label }})
|
||||
runs-on: ${{ matrix.runner }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- label: macOS arm64
|
||||
runner: macos-14
|
||||
target_os: darwin
|
||||
target_arch: arm64
|
||||
- label: macOS x64
|
||||
runner: macos-15-intel
|
||||
target_os: darwin
|
||||
target_arch: x64
|
||||
- label: Windows x64
|
||||
runner: windows-latest
|
||||
target_os: win32
|
||||
target_arch: x64
|
||||
- label: Linux x64
|
||||
runner: ubuntu-22.04
|
||||
target_os: linux
|
||||
target_arch: x64
|
||||
- label: Linux arm64
|
||||
runner: ubuntu-22.04-arm
|
||||
target_os: linux
|
||||
target_arch: arm64
|
||||
skip_browser_runtime: true
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event_name == 'release' && github.event.release.tag_name || github.ref }}
|
||||
|
||||
- name: Resolve runtime asset names
|
||||
id: names
|
||||
shell: bash
|
||||
env:
|
||||
TARGET_OS: ${{ matrix.target_os }}
|
||||
TARGET_ARCH: ${{ matrix.target_arch }}
|
||||
run: |
|
||||
echo "asset=$(node packages/desktop/scripts/runtime-asset-name.mjs)" >> "$GITHUB_OUTPUT"
|
||||
echo "manifest=$(node packages/desktop/scripts/runtime-asset-name.mjs --manifest)" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Check existing release assets
|
||||
id: check
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
TAG: ${{ github.event.release.tag_name || github.event.inputs.tag }}
|
||||
ASSET: ${{ steps.names.outputs.asset }}
|
||||
MANIFEST: ${{ steps.names.outputs.manifest }}
|
||||
run: |
|
||||
assets="$(gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json assets --jq '.assets[].name' || true)"
|
||||
if printf '%s\n' "$assets" | grep -Fx "$ASSET" >/dev/null \
|
||||
&& printf '%s\n' "$assets" | grep -Fx "$MANIFEST" >/dev/null; then
|
||||
echo "missing=false" >> "$GITHUB_OUTPUT"
|
||||
echo "Runtime asset already exists: $ASSET"
|
||||
else
|
||||
echo "missing=true" >> "$GITHUB_OUTPUT"
|
||||
echo "Runtime asset missing: $ASSET or $MANIFEST"
|
||||
fi
|
||||
|
||||
- name: Setup Node.js
|
||||
if: steps.check.outputs.missing == 'true'
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
cache-dependency-path: packages/desktop/package-lock.json
|
||||
|
||||
- name: Install uv
|
||||
if: steps.check.outputs.missing == 'true'
|
||||
uses: astral-sh/setup-uv@v3
|
||||
|
||||
- name: Install desktop dependencies
|
||||
if: steps.check.outputs.missing == 'true'
|
||||
run: npm ci --prefix packages/desktop --no-audit --no-fund
|
||||
|
||||
- name: Prepare runtime resources
|
||||
if: steps.check.outputs.missing == 'true'
|
||||
env:
|
||||
TARGET_OS: ${{ matrix.target_os }}
|
||||
TARGET_ARCH: ${{ matrix.target_arch }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
HERMES_SKIP_BROWSER_RUNTIME: ${{ matrix.skip_browser_runtime || 'false' }}
|
||||
run: npm --prefix packages/desktop run prepare:runtime
|
||||
|
||||
- name: Package runtime
|
||||
if: steps.check.outputs.missing == 'true'
|
||||
env:
|
||||
TARGET_OS: ${{ matrix.target_os }}
|
||||
TARGET_ARCH: ${{ matrix.target_arch }}
|
||||
run: npm --prefix packages/desktop run package:runtime
|
||||
|
||||
- name: Upload runtime assets to release
|
||||
if: steps.check.outputs.missing == 'true'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ github.event.release.tag_name || github.event.inputs.tag }}
|
||||
fail_on_unmatched_files: true
|
||||
files: |
|
||||
packages/desktop/release/runtime/${{ steps.names.outputs.asset }}
|
||||
packages/desktop/release/runtime/${{ steps.names.outputs.asset }}.sha256
|
||||
packages/desktop/release/runtime/${{ steps.names.outputs.manifest }}
|
||||
@@ -0,0 +1,46 @@
|
||||
name: Build and Push Docker Image to Docker Hub
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: docker-${{ github.ref }}
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 45
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/amd64,linux/arm64
|
||||
push: true
|
||||
tags: |
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/hermes-web-ui:latest
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/hermes-web-ui:${{ github.sha }}
|
||||
${{ secrets.DOCKERHUB_USERNAME }}/hermes-web-ui:${{ github.event.release.tag_name || github.ref_name }}
|
||||
@@ -0,0 +1,45 @@
|
||||
name: NPM Lockfile Check
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- package.json
|
||||
- package-lock.json
|
||||
- .github/workflows/npm-lockfile-check.yml
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- base
|
||||
paths:
|
||||
- package.json
|
||||
- package-lock.json
|
||||
- .github/workflows/npm-lockfile-check.yml
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: npm-lockfile-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: npm ci --ignore-scripts
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
cache-dependency-path: package-lock.json
|
||||
|
||||
- name: Verify package-lock.json is in sync
|
||||
run: npm ci --ignore-scripts
|
||||
@@ -0,0 +1,52 @@
|
||||
name: Playwright
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: playwright-${{ github.event.pull_request.number || github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
e2e:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
cache-dependency-path: package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
npm ci --ignore-scripts
|
||||
npm rebuild node-pty
|
||||
|
||||
- name: Install Playwright browsers
|
||||
run: npx playwright install --with-deps chromium
|
||||
|
||||
- name: Run Playwright tests
|
||||
run: npm run test:e2e
|
||||
|
||||
- name: Upload Playwright report
|
||||
if: ${{ !cancelled() }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: playwright-report
|
||||
path: |
|
||||
playwright-report/
|
||||
test-results/
|
||||
retention-days: 7
|
||||
@@ -0,0 +1,89 @@
|
||||
name: Website
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- base
|
||||
paths:
|
||||
- packages/website/**
|
||||
- packages/client/src/styles/variables.scss
|
||||
- package.json
|
||||
- package-lock.json
|
||||
- tsconfig.website.json
|
||||
- vite.config.website.ts
|
||||
- .github/workflows/website-deploy.yml
|
||||
workflow_run:
|
||||
workflows:
|
||||
- Publish Desktop Artifacts to Release
|
||||
types:
|
||||
- completed
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: website-${{ github.event.pull_request.number || github.event.workflow_run.id || github.ref }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build website
|
||||
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
if: github.event_name != 'workflow_run'
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Checkout desktop release ref
|
||||
if: github.event_name == 'workflow_run'
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.workflow_run.head_branch || github.event.workflow_run.head_sha }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24
|
||||
cache: npm
|
||||
cache-dependency-path: package-lock.json
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci --ignore-scripts
|
||||
|
||||
- name: Type-check website
|
||||
run: npx vue-tsc -p tsconfig.website.json --noEmit
|
||||
|
||||
- name: Build website
|
||||
run: npm run build:website
|
||||
|
||||
- name: Prepare SSH
|
||||
if: github.event_name == 'workflow_run' || github.event_name == 'workflow_dispatch'
|
||||
env:
|
||||
WEBSITE_SSH_KEY: ${{ secrets.WEBSITE_SSH_KEY }}
|
||||
WEBSITE_SSH_KNOWN_HOSTS: ${{ secrets.WEBSITE_SSH_KNOWN_HOSTS }}
|
||||
run: |
|
||||
test -n "$WEBSITE_SSH_KEY"
|
||||
mkdir -p ~/.ssh
|
||||
chmod 700 ~/.ssh
|
||||
printf '%s\n' "$WEBSITE_SSH_KEY" > ~/.ssh/website_deploy_key
|
||||
chmod 600 ~/.ssh/website_deploy_key
|
||||
if [ -n "$WEBSITE_SSH_KNOWN_HOSTS" ]; then
|
||||
printf '%s\n' "$WEBSITE_SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
|
||||
fi
|
||||
|
||||
- name: Deploy website
|
||||
if: github.event_name == 'workflow_run' || github.event_name == 'workflow_dispatch'
|
||||
env:
|
||||
WEBSITE_SSH_USER: ${{ secrets.WEBSITE_SSH_USER }}
|
||||
WEBSITE_SSH_PORT: ${{ secrets.WEBSITE_SSH_PORT }}
|
||||
run: |
|
||||
SSH_USER="${WEBSITE_SSH_USER:-root}"
|
||||
SSH_PORT="${WEBSITE_SSH_PORT:-22}"
|
||||
DEPLOY_DIR="/var/www/ekkolearnai.com/current"
|
||||
SSH_CMD="ssh -i ~/.ssh/website_deploy_key -p ${SSH_PORT} -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new"
|
||||
$SSH_CMD "$SSH_USER@154.3.33.232" "mkdir -p '$DEPLOY_DIR' && find '$DEPLOY_DIR' -mindepth 1 -maxdepth 1 -exec rm -rf {} +"
|
||||
tar -C dist/website -czf - . | $SSH_CMD "$SSH_USER@154.3.33.232" "tar -xzf - -C '$DEPLOY_DIR'"
|
||||
Reference in New Issue
Block a user