Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 8d9cf27

Browse files
committed
chore: build cortex js binary
1 parent 9d88d3b commit 8d9cf27

File tree

2 files changed

+43
-17
lines changed

2 files changed

+43
-17
lines changed

.github/workflows/cortex-cpp-build.yml

Lines changed: 41 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,7 @@ name: CI Cortex CPP
33
on:
44
push:
55
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
6-
paths:
7-
[
8-
"cortex-cpp/**",
9-
]
6+
paths: ["cortex-cpp/**", "cortex-js/**"]
107
workflow_dispatch:
118

129
env:
@@ -201,14 +198,14 @@ jobs:
201198
shell: bash
202199
env:
203200
CODE_SIGN_P12_BASE64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
204-
201+
205202
- uses: apple-actions/import-codesign-certs@v2
206203
if: runner.os == 'macOS'
207204
with:
208205
p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
209206
p12-password: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
210207

211-
- name: Build
208+
- name: Build Cortex CPP
212209
run: |
213210
cd cortex-cpp
214211
make build CMAKE_EXTRA_FLAGS="${{ matrix.cmake-flags }}"
@@ -224,6 +221,36 @@ jobs:
224221
cd cortex-cpp
225222
make codesign CODE_SIGN=true DEVELOPER_ID="${{ secrets.DEVELOPER_ID }}"
226223
224+
# Cortex-JS Build
225+
- name: "Update version by tag"
226+
run: |
227+
cd cortex-js
228+
# Remove the v prefix
229+
tag_version=${GITHUB_REF#refs/tags/v}
230+
# Remove the -cortex-js suffix
231+
new_version=${tag_version%-cortex-js}
232+
233+
# Replace the old version with the new version in package.json
234+
jq --arg version "$new_version" '.version = $version' ./package.json > /tmp/package.json && mv /tmp/package.json ./package.json
235+
236+
# Print the new version
237+
echo "Updated package.json version to: $new_version"
238+
239+
# Setup .npmrc file to publish to npm
240+
- uses: actions/setup-node@v3
241+
with:
242+
node-version: "20.x"
243+
registry-url: "https://registry.npmjs.org"
244+
245+
- run: yarn install && yarn build:binary
246+
working-directory: ./cortex-js
247+
248+
- name: Code Signing macOS
249+
if: runner.os == 'macOS'
250+
run: |
251+
cd cortex-js/dist
252+
make codesign CODE_SIGN=true DEVELOPER_ID="${{ secrets.DEVELOPER_ID }}"
253+
227254
- uses: nick-fields/retry@v3
228255
with:
229256
continue_on_error: true
@@ -249,12 +276,18 @@ jobs:
249276
cd cortex-cpp
250277
make run-e2e-test RUN_TESTS=true LLM_MODEL_URL=${{ env.LLM_MODEL_URL }} EMBEDDING_MODEL_URL=${{ env.EMBEDDING_MODEL_URL }}
251278
252-
- name: Upload Artifact
279+
- name: Upload CPP Artifact
253280
uses: actions/upload-artifact@v2
254281
with:
255282
name: cortex-cpp-${{ matrix.os }}-${{ matrix.name }}
256283
path: ./cortex-cpp/cortex-cpp
257284

285+
- name: Upload JS Artifact
286+
uses: actions/upload-artifact@v2
287+
with:
288+
name: cortex-${{ matrix.os }}-${{ matrix.name }}
289+
path: ./cortex-js/dist/cortex
290+
258291
- uses: actions/upload-release-asset@v1.0.1
259292
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
260293
env:
@@ -287,4 +320,4 @@ jobs:
287320
# config-name: my-config.yml
288321
# disable-autolabeler: true
289322
env:
290-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
323+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

cortex-js/src/infrastructure/commanders/usecases/init.cli.usecases.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import {
2-
cpSync,
3-
createWriteStream,
4-
existsSync,
5-
readdir,
6-
readdirSync,
7-
rmSync,
8-
} from 'fs';
1+
import { cpSync, createWriteStream, existsSync, readdirSync, rmSync } from 'fs';
92
import { delimiter, join } from 'path';
103
import { HttpService } from '@nestjs/axios';
114
import { Presets, SingleBar } from 'cli-progress';
@@ -298,7 +291,7 @@ export class InitCliUsecases {
298291
/**
299292
* Download and install ONNX engine
300293
* @param version
301-
* @param engineFileName
294+
* @param engineFileName
302295
*/
303296
async installONNXEngine(
304297
version: string = 'latest',

0 commit comments

Comments
 (0)