mirror of
https://github.com/sipeed/NanoKVM-USB.git
synced 2026-09-11 05:59:57 -05:00
136 lines
3.5 KiB
YAML
136 lines
3.5 KiB
YAML
name: Build Browser and Desktop Apps
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
env:
|
|
NODE_VERSION: '20'
|
|
|
|
jobs:
|
|
detect-changes:
|
|
name: Detect Changed Paths
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
browser: ${{ steps.filter.outputs.browser }}
|
|
desktop: ${{ steps.filter.outputs.desktop }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Filter changes
|
|
id: filter
|
|
uses: dorny/paths-filter@v3
|
|
with:
|
|
filters: |
|
|
browser:
|
|
- 'browser/**'
|
|
desktop:
|
|
- 'desktop/**'
|
|
|
|
build-browser:
|
|
name: Build Browser Bundle
|
|
needs: detect-changes
|
|
runs-on: ubuntu-latest
|
|
if: needs.detect-changes.outputs.browser == 'true'
|
|
defaults:
|
|
run:
|
|
working-directory: browser
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- 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: Upload browser dist
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: browser-dist
|
|
path: browser/dist
|
|
if-no-files-found: error
|
|
|
|
build-desktop:
|
|
name: Build Desktop Apps
|
|
needs: detect-changes
|
|
runs-on: ${{ matrix.os }}
|
|
if: needs.detect-changes.outputs.desktop == 'true'
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-latest
|
|
target: linux
|
|
build_script: build:linux
|
|
artifact_name: desktop-linux
|
|
- os: windows-latest
|
|
target: windows
|
|
build_script: build:win
|
|
artifact_name: desktop-windows
|
|
- os: macos-latest
|
|
target: macos-arm64
|
|
build_script: build:mac
|
|
build_args: --arm64
|
|
artifact_name: desktop-macos-arm64
|
|
- os: macos-13
|
|
target: macos-x64
|
|
build_script: build:mac
|
|
build_args: --x64
|
|
artifact_name: desktop-macos-x64
|
|
defaults:
|
|
run:
|
|
working-directory: desktop
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
|
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
|
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- 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: Import Code-Signing Certificates
|
|
if: startsWith(matrix.os, 'macos')
|
|
uses: apple-actions/import-codesign-certs@v3
|
|
with:
|
|
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
|
|
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Build desktop package
|
|
run: npm run ${{ matrix.build_script }} ${{ matrix.build_args || '' }}
|
|
|
|
- name: Upload desktop artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.artifact_name }}
|
|
path: desktop/dist
|
|
if-no-files-found: error |