Cleanup and sync versions and update author info. #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Rename x86 executable | |
- name: Rename x86 executable | |
run: | | |
ren bin\Release\x86\NWNLogRotator.exe NWNLogRotator-x86.exe | |
# Step 7: 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/NWNLogRotator-x86.exe | |
# Step 8: 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 9: Rename x64 executable | |
- name: Rename x64 executable | |
run: | | |
ren bin\Release\x64\NWNLogRotator.exe NWNLogRotator-x64.exe | |
# Step 10: 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/NWNLogRotator-x64.exe | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Step 2: Download the build artifacts (x86 and x64) | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: Release-build-x86 | |
path: ./bin/Release/x86/ | |
- name: Download build artifacts (x64) | |
uses: actions/download-artifact@v3 | |
with: | |
name: Release-build-x64 | |
path: ./bin/Release/x64/ | |
# Debugging Step: List all downloaded files (Linux) | |
- name: List all downloaded files | |
run: | | |
echo "Listing all downloaded files in x86 directory" | |
find ./bin/Release/x86/ -type f | |
echo "Listing all downloaded files in x64 directory" | |
find ./bin/Release/x64/ -type f | |
# Step 3: Determine the next semantic version tag | |
- name: Calculate next version | |
id: next_version | |
run: | | |
# Fetch all tags to ensure git describe works properly | |
git fetch --tags | |
# Get the latest tag, or default to v1.0.0 if none exists | |
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1) || echo "v1.0.0") | |
echo "Latest tag: $latest_tag" | |
# Calculate the next version | |
next_version=$(echo $latest_tag | awk -F. -v OFS=. '{$NF+=1; print}') | |
echo "next_version=$next_version" >> $GITHUB_ENV | |
# Step 4: Create GitHub release | |
- name: Create GitHub release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.next_version }} | |
name: ${{ env.next_version }} | |
files: | | |
./bin/Release/x86/NWNLogRotator-x86.exe | |
./bin/Release/x64/NWNLogRotator-x64.exe | |
body: | | |
## Changes | |
- Auto-generated release with x86 and x64 binaries. |