Skip to content

Commit f7d5b62

Browse files
build: Add GHA workflow
1 parent 7af05ea commit f7d5b62

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
on: workflow_dispatch
2+
3+
jobs:
4+
build:
5+
name: Build Driver Package and Control Panel
6+
permissions:
7+
contents: write
8+
runs-on: windows-latest
9+
steps:
10+
11+
- name: Checkout Code
12+
uses: actions/checkout@v4
13+
#with:
14+
# repository: vitoplantamura/MagicTrackpad2ForWindows
15+
# ref: master
16+
17+
- name: Create Source Tarball
18+
shell: bash
19+
id: create_tarball
20+
run: |
21+
COMMIT_SHA=$(git rev-parse HEAD)
22+
echo "commit_sha=${COMMIT_SHA}" >> "$GITHUB_OUTPUT"
23+
mkdir .tarball
24+
tar -czf .tarball/source-${COMMIT_SHA}.tar.gz --exclude='.git' --exclude='.tarball' .
25+
26+
- name: Upload Source Tarball
27+
uses: actions/upload-artifact@v4
28+
with:
29+
name: source-code-${{ steps.create_tarball.outputs.commit_sha }}
30+
path: .tarball/source-${{ steps.create_tarball.outputs.commit_sha }}.tar.gz
31+
32+
- name: Setup MSBuild
33+
uses: microsoft/setup-msbuild@v2
34+
35+
- name: Restore NuGet Packages
36+
run: |
37+
nuget restore ./AmtPtpDeviceUsbUm/MagicTrackpad2PtpDevice.vcxproj -PackagesDirectory ${{ github.workspace }}\packages
38+
nuget restore ./AmtPtpHidFilter/AmtPtpHidFilter.vcxproj -PackagesDirectory ${{ github.workspace }}\packages
39+
40+
- name: Build
41+
shell: bash
42+
run: |
43+
sed -i 's|</TimeStampServer>|</TimeStampServer><ApiValidator_Enable>false</ApiValidator_Enable>|g' ./AmtPtpDeviceUsbUm/MagicTrackpad2PtpDevice.vcxproj
44+
sed -i 's|</TimeStampServer>|</TimeStampServer><ApiValidator_Enable>false</ApiValidator_Enable>|g' ./AmtPtpHidFilter/AmtPtpHidFilter.vcxproj
45+
msbuild.exe ./AmtPtpDeviceUsbUm/MagicTrackpad2PtpDevice.vcxproj -p:Configuration=Release -p:Platform=x64
46+
msbuild.exe ./AmtPtpHidFilter/AmtPtpHidFilter.vcxproj -p:Configuration=Release -p:Platform=x64
47+
msbuild.exe ./AmtPtpDeviceUsbUm/MagicTrackpad2PtpDevice.vcxproj -p:Configuration=Release -p:Platform=ARM64
48+
msbuild.exe ./AmtPtpHidFilter/AmtPtpHidFilter.vcxproj -p:Configuration=Release -p:Platform=ARM64
49+
msbuild.exe ./AmtPtpControlPanel/AmtPtpControlPanel.csproj -p:Configuration=Release -p:Platform=AnyCPU
50+
echo -e '.OPTION EXPLICIT\n.Set CabinetFileCountThreshold=0\n.Set FolderFileCountThreshold=0\n.Set FolderSizeThreshold=0\n.Set MaxCabinetSize=0\n.Set MaxDiskFileCount=0\n.Set MaxDiskSize=0\n.Set CompressionType=MSZIP\n.Set Cabinet=on\n.Set Compress=on\n.Set CabinetNameTemplate=drivers.cab\n.Set DestinationDir=AMD64\nbuild\\AmtPtpDevice_AMD64.inf\tAmtPtpDevice.inf\nAmtPtpDeviceUsbUm\\build\\AmtPtpDeviceUsbUm\\x64\\Release\\AmtPtpDeviceUsbUm.dll\nAmtPtpHidFilter\\build\\AmtPtpHidFilter\\x64\\Release\\AmtPtpHidFilter.sys\nAmtPtpDeviceUsbUm\\build\\AmtPtpDeviceUsbUm\\x64\\Release\\AmtPtpDeviceUsbUm.pdb\nAmtPtpHidFilter\\build\\AmtPtpHidFilter\\x64\\Release\\AmtPtpHidFilter.pdb\n.Set DestinationDir=ARM64\nbuild\\AmtPtpDevice_ARM64.inf\tAmtPtpDevice.inf\nAmtPtpDeviceUsbUm\\build\\AmtPtpDeviceUsbUm\\ARM64\\Release\\AmtPtpDeviceUsbUm.dll\nAmtPtpHidFilter\\build\\AmtPtpHidFilter\\ARM64\\Release\\AmtPtpHidFilter.sys\nAmtPtpDeviceUsbUm\\build\\AmtPtpDeviceUsbUm\\ARM64\\Release\\AmtPtpDeviceUsbUm.pdb\nAmtPtpHidFilter\\build\\AmtPtpHidFilter\\ARM64\\Release\\AmtPtpHidFilter.pdb\n' > drivers.ddf
51+
makecab -f drivers.ddf
52+
mkdir result
53+
cp AmtPtpControlPanel/bin/Release/AmtPtpControlPanel.exe result/
54+
mv disk1/drivers.cab result/.
55+
56+
- name: Upload Build Artifacts
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: result
60+
path: result/

0 commit comments

Comments
 (0)