Skip to content
This repository was archived by the owner on Feb 13, 2026. It is now read-only.

Commit 2dae571

Browse files
author
Merrick Zhang
committed
Add GitHub Actions workflow for build and release
1 parent 0d9106f commit 2dae571

File tree

2 files changed

+136
-0
lines changed

2 files changed

+136
-0
lines changed
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
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 }}

build/Notepad4.nsi

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
!define PRODUCT_NAME "Notepad4"
2+
!define PRODUCT_VERSION "${VERSION}"
3+
!define PRODUCT_PUBLISHER "Notepad4 Team"
4+
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Notepad4.exe"
5+
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
6+
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
7+
8+
!include "MUI2.nsh"
9+
10+
!define MUI_ABORTWARNING
11+
!define MUI_ICON "res\\Notepad4.ico"
12+
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\uninstall.ico"
13+
14+
!insertmacro MUI_PAGE_DIRECTORY
15+
!insertmacro MUI_PAGE_INSTFILES
16+
17+
!insertmacro MUI_UNPAGE_CONFIRM
18+
!insertmacro MUI_UNPAGE_INSTFILES
19+
20+
!insertmacro MUI_LANGUAGE "English"
21+
22+
Name "${PRODUCT_NAME} ${PRODUCT_VERSION} (${ARCH})"
23+
OutFile "${OUTPUT_FILE}"
24+
InstallDir "$PROGRAMFILES\${PRODUCT_NAME}"
25+
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "Path"
26+
27+
Section "MainSection" SEC01
28+
SetOutPath "$INSTDIR"
29+
File "${SOURCE_DIR}\Notepad4.exe"
30+
File "${SOURCE_DIR}\matepath.exe"
31+
32+
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\Notepad4.exe"
33+
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME}"
34+
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninstall.exe"
35+
WriteUninstaller "$INSTDIR\uninstall.exe"
36+
SectionEnd
37+
38+
Section "Uninstall"
39+
Delete "$INSTDIR\uninstall.exe"
40+
Delete "$INSTDIR\Notepad4.exe"
41+
Delete "$INSTDIR\matepath.exe"
42+
43+
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
44+
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
45+
46+
RMDir "$INSTDIR"
47+
SectionEnd

0 commit comments

Comments
 (0)