1+ name : Build and Release
2+
3+ on :
4+ push :
5+ branches : [ main, master ]
6+ tags :
7+ - ' v*'
8+ pull_request :
9+ branches : [ main, master ]
10+
11+ jobs :
12+ build :
13+ runs-on : windows-latest
14+ strategy :
15+ matrix :
16+ platform : [Win32, x64, ARM64]
17+ configuration : [Release]
18+
19+ steps :
20+ - uses : actions/checkout@v4
21+
22+ - name : Setup MSBuild
23+ uses : microsoft/setup-msbuild@v2
24+
25+ - name : Setup NSIS
26+ uses : joncloud/makensis-action@v3
27+
28+ - name : Build project
29+ run : |
30+ msbuild build/VisualStudio/Notepad4.sln /p:Configuration=${{ matrix.configuration }} /p:Platform=${{ matrix.platform }} /verbosity:minimal
31+
32+ - name : Create output directory
33+ run : |
34+ New-Item -ItemType Directory -Path "output/${{ matrix.platform }}" -Force
35+
36+ - name : Copy built files
37+ run : |
38+ $srcDir = "build/VisualStudio/${{ matrix.configuration }}/${{ matrix.platform }}"
39+ $destDir = "output/${{ matrix.platform }}"
40+ Copy-Item -Path "$srcDir\Notepad4.exe" -Destination "$destDir"
41+ Copy-Item -Path "$srcDir\matepath.exe" -Destination "$destDir"
42+
43+ - name : Build NSIS installer
44+ run : |
45+ $platform = "${{ matrix.platform }}"
46+ $arch = if ($platform -eq "Win32") { "x86" } elseif ($platform -eq "x64") { "x64" } else { "arm64" }
47+ $version = if ("${{ github.ref }}" -like "refs/tags/*") { "${{ github.ref_name }}" } else { "dev" }
48+ $outputFile = "output\Notepad4-${version}-${arch}.exe"
49+ $sourceDir = "output\${platform}"
50+
51+ makensis /DVERSION="$version" /DARCH="$arch" /DOUTPUT_FILE="$outputFile" /DSOURCE_DIR="$sourceDir" build\Notepad4.nsi
52+
53+ - name : Upload artifacts
54+ uses : actions/upload-artifact@v4
55+ with :
56+ name : Notepad4-${{ matrix.platform }}
57+ path : output/Notepad4-*.exe
58+
59+ release :
60+ needs : build
61+ runs-on : windows-latest
62+ if : startsWith(github.ref, 'refs/tags/v')
63+
64+ steps :
65+ - uses : actions/checkout@v4
66+
67+ - name : Download all artifacts
68+ uses : actions/download-artifact@v4
69+ with :
70+ path : artifacts
71+
72+ - name : Create release
73+ uses : softprops/action-gh-release@v2
74+ with :
75+ files : |
76+ artifacts/**/*.exe
77+ name : Release ${{ github.ref_name }}
78+ body : |
79+ ## Notepad4 ${{ github.ref_name }}
80+
81+ ### Changes
82+ - See commit history for details
83+
84+ ### Download
85+ - Windows x86: Notepad4-${{ github.ref_name }}-x86.exe
86+ - Windows x64: Notepad4-${{ github.ref_name }}-x64.exe
87+ - Windows ARM64: Notepad4-${{ github.ref_name }}-arm64.exe
88+ env :
89+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments