Skip to content

Commit 22d780d

Browse files
committed
Sync dev branch changes
1 parent 3094a8b commit 22d780d

7 files changed

Lines changed: 187 additions & 15 deletions

File tree

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
pull_request:
99
branches:
1010
- main
11-
11+
1212
env:
1313
NODE_VERSION: '20'
1414

@@ -100,7 +100,7 @@ jobs:
100100
if: matrix.os == 'ubuntu-latest'
101101
run: |
102102
sudo apt-get update
103-
sudo apt-get install -y build-essential python3 libudev-dev
103+
sudo apt-get install -y build-essential python3 libudev-dev rpm
104104
105105
- name: Install dependencies
106106
run: npm install
@@ -113,4 +113,4 @@ jobs:
113113
with:
114114
name: ${{ matrix.artifact_name }}
115115
path: desktop/dist
116-
if-no-files-found: error
116+
if-no-files-found: error

.github/workflows/release.yml

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
name: Create Tag and Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: 'Tag name'
8+
required: true
9+
type: string
10+
prerelease:
11+
description: 'Mark as pre-release'
12+
required: false
13+
type: boolean
14+
default: false
15+
draft:
16+
description: 'Create as draft'
17+
required: false
18+
type: boolean
19+
default: false
20+
21+
env:
22+
NODE_VERSION: '20'
23+
24+
jobs:
25+
create-tag:
26+
name: Create Git Tag
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Create and push tag
35+
run: |
36+
git config user.name "github-actions[bot]"
37+
git config user.email "github-actions[bot]@users.noreply.github.com"
38+
git tag -a ${{ inputs.tag }} -m "Release ${{ inputs.tag }}"
39+
git push origin ${{ inputs.tag }}
40+
41+
build-browser:
42+
name: Build Browser Bundle
43+
needs: create-tag
44+
runs-on: ubuntu-latest
45+
defaults:
46+
run:
47+
working-directory: browser
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
with:
52+
ref: ${{ inputs.tag }}
53+
54+
- name: Setup Node.js
55+
uses: actions/setup-node@v4
56+
with:
57+
node-version: ${{ env.NODE_VERSION }}
58+
59+
- name: Install dependencies
60+
run: npm install
61+
62+
- name: Build static site
63+
run: npm run build
64+
65+
- name: Create browser archive
66+
run: |
67+
cd dist
68+
zip -r ../nanokvm-usb-browser-${{ inputs.tag }}.zip .
69+
cd ..
70+
71+
- name: Upload browser artifact
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: browser-release
75+
path: browser/nanokvm-usb-browser-${{ inputs.tag }}.zip
76+
if-no-files-found: error
77+
78+
build-desktop:
79+
name: Build Desktop Apps
80+
needs: create-tag
81+
runs-on: ${{ matrix.os }}
82+
strategy:
83+
fail-fast: false
84+
matrix:
85+
include:
86+
- os: ubuntu-latest
87+
target: linux
88+
build_script: build:linux-full
89+
artifact_name: desktop-linux
90+
- os: windows-latest
91+
target: windows
92+
build_script: build:win-full
93+
artifact_name: desktop-windows
94+
defaults:
95+
run:
96+
working-directory: desktop
97+
env:
98+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
steps:
100+
- name: Checkout
101+
uses: actions/checkout@v4
102+
with:
103+
ref: ${{ inputs.tag }}
104+
105+
- name: Setup Node.js
106+
uses: actions/setup-node@v4
107+
with:
108+
node-version: ${{ env.NODE_VERSION }}
109+
110+
- name: Install Linux build dependencies
111+
if: matrix.os == 'ubuntu-latest'
112+
run: |
113+
sudo apt-get update
114+
sudo apt-get install -y build-essential python3 libudev-dev rpm
115+
116+
- name: Install dependencies
117+
run: npm install
118+
119+
- name: Build desktop package
120+
run: npm run ${{ matrix.build_script }}
121+
122+
- name: Upload desktop artifacts
123+
uses: actions/upload-artifact@v4
124+
with:
125+
name: ${{ matrix.artifact_name }}
126+
path: |
127+
desktop/dist/*.exe
128+
desktop/dist/*.AppImage
129+
desktop/dist/*.deb
130+
desktop/dist/*.rpm
131+
desktop/dist/latest*.yml
132+
if-no-files-found: error
133+
134+
create-release:
135+
name: Create GitHub Release
136+
needs: [build-browser, build-desktop]
137+
runs-on: ubuntu-latest
138+
permissions:
139+
contents: write
140+
steps:
141+
- name: Download all artifacts
142+
uses: actions/download-artifact@v4
143+
with:
144+
path: release-artifacts
145+
146+
- name: Display structure of downloaded files
147+
run: ls -R release-artifacts
148+
149+
- name: Create Release
150+
uses: softprops/action-gh-release@v1
151+
with:
152+
tag_name: ${{ inputs.tag }}
153+
name: ${{ inputs.tag }}
154+
draft: ${{ inputs.draft }}
155+
prerelease: ${{ inputs.prerelease }}
156+
files: |
157+
release-artifacts/**/*
158+
generate_release_notes: true
159+
env:
160+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

browser/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ pnpm dev
1515
## Deployment
1616

1717
1. Execute `pnpm build` to build the project.
18-
2. Execute `npm install -g http-server` to install http-server.
19-
3. Execute `http-server -p 8080 -a localhost` to run the service.
20-
4. Open the Chrome browser and visit `http://localhost:8080`.
18+
2. Execute `pnpm install -g http-server` to install http-server.
19+
3. Execute `cd dist` to change working directory to `dist/` .
20+
4. Execute `http-server -p 8080 -a localhost` to run the service.
21+
5. Open the Chrome browser and visit `http://localhost:8080`.
2122

2223
### Deploy in Docker
2324

browser/src/libs/camera/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ class Camera {
1313
this.close();
1414

1515
const constraints = {
16-
video: { deviceId: { exact: id }, width: { ideal: width }, height: { ideal: height } },
16+
video: {
17+
deviceId: { exact: id },
18+
width: { ideal: width },
19+
height: { ideal: height },
20+
frameRate: { ideal: 60 }
21+
},
1722
audio: audioId ? { deviceId: { exact: audioId } } : false
1823
};
1924

desktop/electron-builder.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ win:
2121
nsis:
2222
oneClick: false
2323
allowToChangeInstallationDirectory: true
24-
artifactName: ${productName}-${version}-setup.${ext}
24+
artifactName: ${productName}-${version}-${os}-${arch}-setup.${ext}
2525
shortcutName: ${productName}
2626
uninstallDisplayName: ${productName}
2727
createDesktopShortcut: true
@@ -39,19 +39,17 @@ mac:
3939
notarize: false
4040

4141
dmg:
42-
artifactName: ${productName}-${version}.${ext}
42+
artifactName: ${productName}-${version}-${os}-${arch}.${ext}
4343
sign: true
4444

4545
linux:
4646
target:
4747
- AppImage
48-
- snap
4948
- deb
49+
- rpm
5050
maintainer: sipeed.com
5151
category: Utility
52-
53-
appImage:
54-
artifactName: ${productName}-${version}.${ext}
52+
artifactName: '${productName}-${version}-${os}-${arch}.${ext}'
5553

5654
npmRebuild: false
5755

desktop/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@
1717
"build:unpack": "npm run build && electron-builder --dir",
1818
"build:win": "npm run build && electron-builder --win",
1919
"build:mac": "electron-vite build && electron-builder --mac",
20-
"build:linux": "electron-vite build && electron-builder --linux"
20+
"build:linux": "electron-vite build && electron-builder --linux",
21+
"build:win-full": "npm run build && electron-builder --win --x64 --arm64",
22+
"build:mac-full": "electron-vite build && electron-builder --mac --x64 --arm64",
23+
"build:linux-full": "electron-vite build && electron-builder --linux --x64 --arm64"
2124
},
2225
"dependencies": {
2326
"@ant-design/icons": "^5.6.1",

desktop/src/renderer/src/libs/camera/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ class Camera {
1313
this.close()
1414

1515
const constraints = {
16-
video: { deviceId: { exact: id }, width: { ideal: width }, height: { ideal: height } },
16+
video: {
17+
deviceId: { exact: id },
18+
width: { ideal: width },
19+
height: { ideal: height },
20+
frameRate: { ideal: 60 }
21+
},
1722
audio: audioId ? { deviceId: { exact: audioId } } : false
1823
}
1924

0 commit comments

Comments
 (0)