syntax fixed #6
This file contains hidden or 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: Windows Build | |
on: | |
push: | |
branches: [main, master, develop] # Trigger on pushes to main branches | |
tags: | |
- v*.*.* # Also trigger on version tags for releases | |
pull_request: | |
branches: [main, master] # Also trigger on PRs to main branches | |
jobs: | |
build: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
configuration: [Release, Debug] | |
steps: | |
# Step 1: Checkout the repository | |
- uses: actions/checkout@v4 | |
name: Checkout the repository | |
# Step 2: Setup CMake (same as AppVeyor) | |
- name: Setup CMake | |
uses: jwlawson/[email protected] | |
with: | |
cmake-version: 3.28.0 | |
# Step 3: Verify CMake (same as AppVeyor) | |
- name: Verify CMake | |
run: cmake --version | |
# Step 4: Configure with CMake presets (same as AppVeyor) | |
- name: Configure CMake | |
run: cmake --preset ninja-multi | |
# Step 5: Build with CMake presets (same as AppVeyor) | |
- name: Build with CMake | |
run: | | |
if ("${{ matrix.configuration }}" -eq "Debug") { cmake --build --preset ninja-multi-debug } | |
if ("${{ matrix.configuration }}" -eq "Release") { cmake --build --preset ninja-multi-release } | |
# Step 6: Generate Doxygen documentation | |
- name: Generate Doxygen documentation | |
run: | | |
# Install Doxygen if not available | |
if (-not (Get-Command doxygen -ErrorAction SilentlyContinue)) { | |
choco install doxygen.portable -y | |
} | |
doxygen Doxyfile | |
# Step 7: Upload documentation as an artifact | |
- name: Upload documentation | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cpp_documentation_windows_${{ matrix.configuration }} | |
path: docs | |
# Step 8: Upload build artifacts as an artifact | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cpp_build_output_windows_${{ matrix.configuration }} | |
path: build | |
release: | |
needs: build | |
runs-on: windows-latest | |
if: startsWith(github.ref, 'refs/tags/') # Only run on tag pushes | |
steps: | |
# Step 1: Checkout the repository | |
- uses: actions/checkout@v4 | |
name: Checkout the repository | |
# Step 2: Create a GitHub release using the version tag (e.g., v1.0.0, v1.0.1) | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref_name }} # Use just the tag name (e.g., v1.0.0) | |
release_name: Release ${{ github.ref_name }} # Name the release after the tag (e.g., v1.0.0) | |
body: | | |
Release notes for version ${{ github.ref_name }}. | |
draft: false | |
prerelease: false | |
# Step 3: Upload build artifacts to release | |
- name: Upload build artifacts to release | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: build/Release/main.exe # Adjust to your actual file | |
asset_name: main_windows.exe # Adjust this to name the artifact file | |
asset_content_type: application/octet-stream | |
# Step 4: Upload documentation to release | |
- name: Upload documentation to release | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: docs | |
asset_name: cpp_documentation_windows | |
asset_content_type: application/zip |