Skip to content

Add nightly build workflow and Windows installer #1

Add nightly build workflow and Windows installer

Add nightly build workflow and Windows installer #1

Workflow file for this run

name: Nightly build
on:
push:
branches: [ main ]
permissions:
contents: write
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup NSIS
run: winget install NSIS.NSIS
- name: Initialize MSVC environment
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
echo MSVC environment initialized.
- name: Build with build.bat
shell: cmd
run: call build.bat
- name: Compile the NSIS installer
shell: cmd
run: '"C:\Program Files (x86)\NSIS\makensis.exe" .\installer\installer.nsi'
- name: Get commit hash
id: get_commit
shell: bash
run: |
echo "COMMIT_HASH=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Generate release notes
id: release_notes
shell: bash
run: |
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -z "$LAST_TAG" ]; then
RANGE=""
else
RANGE="$LAST_TAG..HEAD"
fi
git log $RANGE --pretty=format:"* %s%n> %b%n" --reverse > release_notes.txt
# Escape % for GH Actions env file
sed 's/%/%25/g; s/\r/%0D/g; s/\n/%0A/g' release_notes.txt > release_notes_escaped.txt
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
cat release_notes_escaped.txt >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Create release and upload installer
uses: softprops/action-gh-release@v2
with:
name: nightly-${{ env.COMMIT_HASH }}
tag_name: nightly-${{ env.COMMIT_HASH }}
body: |
${{ env.RELEASE_NOTES }}
Note that this release is automated per COMMIT. Stability may vary.
files: installer\OpenCMDInstaller.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}