77 workflow_dispatch :
88 inputs :
99 branch :
10- description : " 要构建的代码分支(例如: unity) "
10+ description : " Git branch to build (e.g., unity) "
1111 required : true
1212 default : " main"
1313 dll_name :
14+ description : " Base name for the output DLL (without extension)"
1415 required : true
1516 default : " openimsdk"
1617 package_path :
18+ description : " Go package path to build (relative to repo root, e.g., ./ )"
1719 required : true
1820 default : " ./"
1921
@@ -34,18 +36,25 @@ jobs:
3436 suffix : 386
3537
3638 steps :
37- - name : Checkout
39+ - name : Checkout target branch (e.g., unity)
3840 uses : actions/checkout@v4
3941 with :
40-
42+ # IMPORTANT: the workflow file stays on main; we checkout the target source branch here
4143 ref : ${{ inputs.branch }}
44+ fetch-depth : 0
45+ # submodules: recursive # uncomment if your repo uses submodules
4246
43- - name : Setup Go 1.20
47+ - name : Show current commit
48+ run : |
49+ echo "Building from branch: ${{ inputs.branch }}"
50+ git log -1 --oneline
51+
52+ - name : Set up Go 1.20
4453 uses : actions/setup-go@v5
4554 with :
4655 go-version : " 1.20"
4756
48- - name : Install mingw-w64 for CGO cross-compile
57+ - name : Install mingw-w64 for CGO cross-compilation
4958 run : |
5059 sudo apt-get update
5160 sudo apt-get install -y --no-install-recommends mingw-w64
@@ -57,22 +66,23 @@ jobs:
5766 CGO_ENABLED : " 1"
5867 CC : ${{ matrix.cc }}
5968 CXX : ${{ matrix.cxx }}
60-
69+ # Win7 compatibility macros (adjust or remove if not needed)
6170 CGO_CFLAGS : " -D_WIN32_WINNT=0x0601 -DWINVER=0x0601"
71+ # If you need more static linking, try enabling the following (verify dependency compatibility):
72+ # CGO_LDFLAGS: "-static -static-libgcc -static-libstdc++"
6273 run : |
6374 mkdir -p windows
64-
65-
6675 OUT="windows/${{ inputs.dll_name }}_${{ matrix.suffix }}.dll"
6776
6877 echo "Building ${OUT} ..."
6978 go build -buildmode=c-shared -trimpath -ldflags="-s -w" \
7079 -o "${OUT}" \
7180 "${{ inputs.package_path }}"
7281
82+ echo "Listing artifacts in windows/:"
7383 ls -l windows
7484
75- - name : Upload Artifacts
85+ - name : Upload artifacts
7686 uses : actions/upload-artifact@v4
7787 with :
7888 name : ${{ inputs.dll_name }}-win-dlls
0 commit comments