Skip to content

Implement GitHub actions to build exe on commits #10

Implement GitHub actions to build exe on commits

Implement GitHub actions to build exe on commits #10

Workflow file for this run

name: Build and Release NWN Log Rotator
on:
push:
branches:
- master
pull_request:
jobs:
build:
runs-on: windows-latest
steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up Visual Studio for .NET Framework
- name: Setup Visual Studio
uses: microsoft/setup-msbuild@v1
# Step 3: Install NuGet
- name: Install NuGet
uses: NuGet/setup-nuget@v1
# Step 4: Restore NuGet packages
- name: Restore NuGet packages
run: nuget restore NWNLogRotator.sln
# Step 5: Build the solution for x86
- name: Build solution (x86)
run: msbuild NWNLogRotator.sln /p:Configuration=Release /p:Platform="x86" /p:OutDir="bin/Release/x86/"
# Debugging Step for x86 Build
- name: Debug x86 Build Output
run: |
echo "Listing files in bin/Release/x86/"
dir bin\Release\x86\
# Step 6: Archive x86 binaries as build artifacts
- name: Archive x86 Release binaries
uses: actions/upload-artifact@v3
with:
name: Release-build-x86
path: |
bin/Release/x86/
# Step 7: Build the solution for x64
- name: Build solution (x64)
run: msbuild NWNLogRotator.sln /p:Configuration=Release /p:Platform="x64" /p:OutDir="bin/Release/x64/"
# Debugging Step for x64 Build
- name: Debug x64 Build Output
run: |
echo "Listing files in bin/Release/x64/"
dir bin\Release\x64\
# Step 8: Archive x64 binaries as build artifacts
- name: Archive x64 Release binaries
uses: actions/upload-artifact@v3
with:
name: Release-build-x64
path: |
bin/Release/x64/
release:
needs: build
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Determine the next semantic version tag
- name: Calculate next version
id: next_version
run: |
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1) || echo "0.0.0")
echo "Latest tag: $latest_tag"
next_version=$(echo $latest_tag | awk -F. -v OFS=. '{$NF+=1; print}')
echo "Next version: $next_version"
echo "next_version=$next_version" >> $GITHUB_ENV
# Step 3: Create GitHub release
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
tag_name: v${{ env.next_version }}
name: Release v${{ env.next_version }}
files: |
bin/Release/x86/*.exe
bin/Release/x64/*.exe
body: |
## Changes
- Auto-generated release with x86 and x64 binaries.