mirror of
https://github.com/sipeed/NanoKVM-USB.git
synced 2026-09-10 21:49:56 -05:00
Sync dev branch changes
This commit is contained in:
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@@ -8,7 +8,7 @@ on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
|
||||
env:
|
||||
NODE_VERSION: '20'
|
||||
|
||||
@@ -100,7 +100,7 @@ jobs:
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential python3 libudev-dev
|
||||
sudo apt-get install -y build-essential python3 libudev-dev rpm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
@@ -113,4 +113,4 @@ jobs:
|
||||
with:
|
||||
name: ${{ matrix.artifact_name }}
|
||||
path: desktop/dist
|
||||
if-no-files-found: error
|
||||
if-no-files-found: error
|
||||
160
.github/workflows/release.yml
vendored
Normal file
160
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
name: Create Tag and Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Tag name'
|
||||
required: true
|
||||
type: string
|
||||
prerelease:
|
||||
description: 'Mark as pre-release'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
draft:
|
||||
description: 'Create as draft'
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
env:
|
||||
NODE_VERSION: '20'
|
||||
|
||||
jobs:
|
||||
create-tag:
|
||||
name: Create Git Tag
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Create and push tag
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git tag -a ${{ inputs.tag }} -m "Release ${{ inputs.tag }}"
|
||||
git push origin ${{ inputs.tag }}
|
||||
|
||||
build-browser:
|
||||
name: Build Browser Bundle
|
||||
needs: create-tag
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: browser
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.tag }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Build static site
|
||||
run: npm run build
|
||||
|
||||
- name: Create browser archive
|
||||
run: |
|
||||
cd dist
|
||||
zip -r ../nanokvm-usb-browser-${{ inputs.tag }}.zip .
|
||||
cd ..
|
||||
|
||||
- name: Upload browser artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: browser-release
|
||||
path: browser/nanokvm-usb-browser-${{ inputs.tag }}.zip
|
||||
if-no-files-found: error
|
||||
|
||||
build-desktop:
|
||||
name: Build Desktop Apps
|
||||
needs: create-tag
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
target: linux
|
||||
build_script: build:linux-full
|
||||
artifact_name: desktop-linux
|
||||
- os: windows-latest
|
||||
target: windows
|
||||
build_script: build:win-full
|
||||
artifact_name: desktop-windows
|
||||
defaults:
|
||||
run:
|
||||
working-directory: desktop
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.tag }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Install Linux build dependencies
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential python3 libudev-dev rpm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Build desktop package
|
||||
run: npm run ${{ matrix.build_script }}
|
||||
|
||||
- name: Upload desktop artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact_name }}
|
||||
path: |
|
||||
desktop/dist/*.exe
|
||||
desktop/dist/*.AppImage
|
||||
desktop/dist/*.deb
|
||||
desktop/dist/*.rpm
|
||||
desktop/dist/latest*.yml
|
||||
if-no-files-found: error
|
||||
|
||||
create-release:
|
||||
name: Create GitHub Release
|
||||
needs: [build-browser, build-desktop]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: release-artifacts
|
||||
|
||||
- name: Display structure of downloaded files
|
||||
run: ls -R release-artifacts
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ inputs.tag }}
|
||||
name: ${{ inputs.tag }}
|
||||
draft: ${{ inputs.draft }}
|
||||
prerelease: ${{ inputs.prerelease }}
|
||||
files: |
|
||||
release-artifacts/**/*
|
||||
generate_release_notes: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -15,9 +15,10 @@ pnpm dev
|
||||
## Deployment
|
||||
|
||||
1. Execute `pnpm build` to build the project.
|
||||
2. Execute `npm install -g http-server` to install http-server.
|
||||
3. Execute `http-server -p 8080 -a localhost` to run the service.
|
||||
4. Open the Chrome browser and visit `http://localhost:8080`.
|
||||
2. Execute `pnpm install -g http-server` to install http-server.
|
||||
3. Execute `cd dist` to change working directory to `dist/` .
|
||||
4. Execute `http-server -p 8080 -a localhost` to run the service.
|
||||
5. Open the Chrome browser and visit `http://localhost:8080`.
|
||||
|
||||
### Deploy in Docker
|
||||
|
||||
|
||||
@@ -13,7 +13,12 @@ class Camera {
|
||||
this.close();
|
||||
|
||||
const constraints = {
|
||||
video: { deviceId: { exact: id }, width: { ideal: width }, height: { ideal: height } },
|
||||
video: {
|
||||
deviceId: { exact: id },
|
||||
width: { ideal: width },
|
||||
height: { ideal: height },
|
||||
frameRate: { ideal: 60 }
|
||||
},
|
||||
audio: audioId ? { deviceId: { exact: audioId } } : false
|
||||
};
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ win:
|
||||
nsis:
|
||||
oneClick: false
|
||||
allowToChangeInstallationDirectory: true
|
||||
artifactName: ${productName}-${version}-setup.${ext}
|
||||
artifactName: ${productName}-${version}-${os}-${arch}-setup.${ext}
|
||||
shortcutName: ${productName}
|
||||
uninstallDisplayName: ${productName}
|
||||
createDesktopShortcut: true
|
||||
@@ -39,19 +39,17 @@ mac:
|
||||
notarize: false
|
||||
|
||||
dmg:
|
||||
artifactName: ${productName}-${version}.${ext}
|
||||
artifactName: ${productName}-${version}-${os}-${arch}.${ext}
|
||||
sign: true
|
||||
|
||||
linux:
|
||||
target:
|
||||
- AppImage
|
||||
- snap
|
||||
- deb
|
||||
- rpm
|
||||
maintainer: sipeed.com
|
||||
category: Utility
|
||||
|
||||
appImage:
|
||||
artifactName: ${productName}-${version}.${ext}
|
||||
artifactName: '${productName}-${version}-${os}-${arch}.${ext}'
|
||||
|
||||
npmRebuild: false
|
||||
|
||||
|
||||
@@ -17,7 +17,10 @@
|
||||
"build:unpack": "npm run build && electron-builder --dir",
|
||||
"build:win": "npm run build && electron-builder --win",
|
||||
"build:mac": "electron-vite build && electron-builder --mac",
|
||||
"build:linux": "electron-vite build && electron-builder --linux"
|
||||
"build:linux": "electron-vite build && electron-builder --linux",
|
||||
"build:win-full": "npm run build && electron-builder --win --x64 --arm64",
|
||||
"build:mac-full": "electron-vite build && electron-builder --mac --x64 --arm64",
|
||||
"build:linux-full": "electron-vite build && electron-builder --linux --x64 --arm64"
|
||||
},
|
||||
"dependencies": {
|
||||
"@ant-design/icons": "^5.6.1",
|
||||
|
||||
@@ -13,7 +13,12 @@ class Camera {
|
||||
this.close()
|
||||
|
||||
const constraints = {
|
||||
video: { deviceId: { exact: id }, width: { ideal: width }, height: { ideal: height } },
|
||||
video: {
|
||||
deviceId: { exact: id },
|
||||
width: { ideal: width },
|
||||
height: { ideal: height },
|
||||
frameRate: { ideal: 60 }
|
||||
},
|
||||
audio: audioId ? { deviceId: { exact: audioId } } : false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user