Skip to content

Commit 33955ce

Browse files
committed
Add nightly build workflow and Windows installer
Introduces a GitHub Actions workflow for nightly builds on the main branch, automating build, installer creation, and release publishing. Adds an NSIS installer script for Windows, and updates .gitignore to exclude common binary outputs.
1 parent 0b8bfdd commit 33955ce

3 files changed

Lines changed: 107 additions & 1 deletion

File tree

.github/workflows/nightly.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Nightly build
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
build:
12+
runs-on: windows-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup NSIS
19+
run: winget install NSIS.NSIS
20+
21+
- name: Initialize MSVC environment
22+
shell: cmd
23+
run: |
24+
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
25+
echo MSVC environment initialized.
26+
27+
- name: Build with build.bat
28+
shell: cmd
29+
run: call build.bat
30+
31+
- name: Compile the NSIS installer
32+
shell: cmd
33+
run: '"C:\Program Files (x86)\NSIS\makensis.exe" .\installer\installer.nsi'
34+
35+
- name: Get commit hash
36+
id: get_commit
37+
shell: bash
38+
run: |
39+
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
40+
41+
- name: Generate release notes
42+
id: release_notes
43+
shell: bash
44+
run: |
45+
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
46+
if [ -z "$LAST_TAG" ]; then
47+
RANGE=""
48+
else
49+
RANGE="$LAST_TAG..HEAD"
50+
fi
51+
git log $RANGE --pretty=format:"* %s%n> %b%n" --reverse > release_notes.txt
52+
# Escape % for GH Actions env file
53+
sed 's/%/%25/g; s/\r/%0D/g; s/\n/%0A/g' release_notes.txt > release_notes_escaped.txt
54+
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
55+
cat release_notes_escaped.txt >> $GITHUB_ENV
56+
echo "EOF" >> $GITHUB_ENV
57+
58+
- name: Create release and upload installer
59+
uses: softprops/action-gh-release@v2
60+
with:
61+
name: nightly-${{ env.COMMIT_HASH }}
62+
tag_name: nightly-${{ env.COMMIT_HASH }}
63+
body: |
64+
${{ env.RELEASE_NOTES }}
65+
66+
Note that this release is automated per COMMIT. Stability may vary.
67+
files: installer\OpenCMDInstaller.exe
68+
env:
69+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,10 @@ compile_commands.json
1010
CTestTestfile.cmake
1111
_deps
1212
CMakeUserPresets.json
13-
build/
13+
build/
14+
*.exe
15+
*.dll
16+
*.dylib
17+
*.so
18+
*.out
19+
*.bin

installer/installer.nsi

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
!include LogicLib.nsh
2+
!include WinMessages.nsh
3+
!include WinVer.nsh
4+
!include StrFunc.nsh
5+
${Using:StrFunc} StrStr
6+
7+
OutFile "OpenCMDInstaller.exe"
8+
InstallDir "$PROFILE\OpenCMD"
9+
RequestExecutionLevel user
10+
11+
Section "Install"
12+
SetOutPath "$INSTDIR"
13+
File "..\build\Debug\opencmd.exe"
14+
15+
ReadRegStr $0 HKCU "Environment" "Path"
16+
StrCpy $1 $INSTDIR
17+
18+
${If} $0 != ""
19+
${StrStr} $2 $0 $1
20+
${If} $2 == ""
21+
StrCpy $0 "$0;$INSTDIR"
22+
WriteRegStr HKCU "Environment" "Path" "$0"
23+
; Broadcast the environment change
24+
System::Call 'User32::SendMessageTimeout(i 0xffff, i ${WM_SETTINGCHANGE}, i 0, t "Environment", i 0x0002, i 5000, *i .r0)'
25+
${EndIf}
26+
${Else}
27+
WriteRegStr HKCU "Environment" "Path" "$INSTDIR"
28+
System::Call 'User32::SendMessageTimeout(i 0xffff, i ${WM_SETTINGCHANGE}, i 0, t "Environment", i 0x0002, i 5000, *i .r0)'
29+
${EndIf}
30+
MessageBox MB_OK "Installation complete. Please restart any running programs for PATH changes to apply."
31+
SectionEnd

0 commit comments

Comments
 (0)