Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Build BS2PRO-Controller

on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
workflow_dispatch:

jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actions/setup-go is pinned to Go 1.23, but go.mod declares go 1.26.0. This will cause CI failures or unexpected behavior when module/toolchain features differ. Prefer go-version-file: go.mod or update go-version to match the required Go toolchain.

Suggested change
go-version: '1.23'
go-version-file: 'go.mod'

Copilot uses AI. Check for mistakes.

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Set up .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Install Bun
uses: oven-sh/setup-bun@v2

- name: Install Wails
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest

- name: Install go-winres
run: go install github.com/tc-hib/go-winres@latest

- name: Install NSIS
run: |
choco install nsis -y
echo "C:\Program Files (x86)\NSIS" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Install frontend dependencies
working-directory: frontend
run: bun install

- name: Extract version
id: version
shell: pwsh
run: |
$json = Get-Content wails.json | ConvertFrom-Json
$ver = $json.info.productVersion
echo "VERSION=$ver" >> $env:GITHUB_OUTPUT

- name: Set LDFLAGS
shell: pwsh
run: |
echo "LDFLAGS=-X github.com/TIANLI0/BS2PRO-Controller/internal/version.BuildVersion=${{ steps.version.outputs.VERSION }} -H=windowsgui" >> $env:GITHUB_ENV

- name: Build core service
run: |
go-winres make --in cmd/core/winres/winres.json --out cmd/core/rsrc
go build -ldflags "${{ env.LDFLAGS }}" -o build/bin/BS2PRO-Core.exe ./cmd/core/

- name: Build TempBridge
run: |
dotnet restore bridge/TempBridge/TempBridge.csproj
dotnet publish bridge/TempBridge/TempBridge.csproj -c Release --self-contained false -o build/bin/bridge

- name: Build main application (Wails + NSIS installer)
run: wails build -nsis -ldflags "${{ env.LDFLAGS }}"

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: BS2PRO-Controller-${{ steps.version.outputs.VERSION }}
path: |
build/bin/*.exe
build/bin/bridge/
retention-days: 30

- name: Upload installer
uses: actions/upload-artifact@v4
with:
name: BS2PRO-Controller-Installer-${{ steps.version.outputs.VERSION }}
path: build/bin/*installer*.exe
retention-days: 30
4 changes: 2 additions & 2 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"-ExecutionPolicy",
"Bypass",
"-Command",
"$ErrorActionPreference='Stop'; if (-not (Get-Command riscv-none-elf-objcopy -ErrorAction SilentlyContinue)) { throw '未找到 riscv-none-elf-objcopy,请先安装 RISC-V GNU Toolchain 并加入 PATH' }; if (-not (Get-Command riscv-none-elf-objdump -ErrorAction SilentlyContinue)) { throw '未找到 riscv-none-elf-objdump,请先安装 RISC-V GNU Toolchain 并加入 PATH' }; riscv-none-elf-objcopy -I binary -O elf32-littleriscv -B riscv ota/CH591_For_BS2PRO_Ver0.0.3.5.bin ota/fw.elf; riscv-none-elf-objdump -D -M no-aliases ota/fw.elf > ota/fw.asm; Write-Host 'ELF/ASM generated: ota/fw.elf, ota/fw.asm'"
"$ErrorActionPreference='Stop'; if (-not (Get-Command riscv-none-elf-objcopy -ErrorAction SilentlyContinue)) { throw 'riscv-none-elf-objcopy not found. Please install RISC-V GNU Toolchain and add it to PATH.' }; if (-not (Get-Command riscv-none-elf-objdump -ErrorAction SilentlyContinue)) { throw 'riscv-none-elf-objdump not found. Please install RISC-V GNU Toolchain and add it to PATH.' }; riscv-none-elf-objcopy -I binary -O elf32-littleriscv -B riscv ota/CH591_For_BS2PRO_Ver0.0.3.5.bin ota/fw.elf; riscv-none-elf-objdump -D -M no-aliases ota/fw.elf > ota/fw.asm; Write-Host 'ELF/ASM generated: ota/fw.elf, ota/fw.asm'"
],
"problemMatcher": []
},
Expand Down Expand Up @@ -106,7 +106,7 @@
"-ExecutionPolicy",
"Bypass",
"-Command",
"$ErrorActionPreference='Stop'; if (-not (Get-Command rizin -ErrorAction SilentlyContinue)) { throw '未找到 rizin,请先安装 rizin 并加入 PATH' }; rizin -a riscv -b 32 -m 0x0 ota/CH591_For_BS2PRO_Ver0.0.3.5.bin"
"$ErrorActionPreference='Stop'; if (-not (Get-Command rizin -ErrorAction SilentlyContinue)) { throw 'rizin not found. Please install rizin and add it to PATH.' }; rizin -a riscv -b 32 -m 0x0 ota/CH591_For_BS2PRO_Ver0.0.3.5.bin"
],
"problemMatcher": []
}
Expand Down
Loading
Loading