Skip to content

Fix GitHub Actions workflow to produce functional artifacts#1

Merged
lsd-techno merged 3 commits intomainfrom
copilot/fix-86bb6a9a-9d0e-47a5-b169-b10a6976d9c1
Sep 7, 2025
Merged

Fix GitHub Actions workflow to produce functional artifacts#1
lsd-techno merged 3 commits intomainfrom
copilot/fix-86bb6a9a-9d0e-47a5-b169-b10a6976d9c1

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Sep 7, 2025

The GitHub Actions workflow for building GateSwitchWay was producing artifacts that were non-functional due to several critical issues. This PR fixes all identified problems to ensure the built executables work correctly on target Windows systems.

Issues Fixed

1. Workflow Filename Typo

The workflow file was incorrectly named publush.yml instead of publish.yml, which could cause confusion and maintenance issues.

2. PowerShell Version Detection Bug

The version detection logic had a critical flaw:

# Before (broken) - returns "True" when git command fails
$version = $(git describe --tags --abbrev=0) -or "0.0.0"

# After (fixed) - properly handles errors and returns fallback
try {
    $version = git describe --tags --abbrev=0 2>$null
    if ($LASTEXITCODE -ne 0) {
        $version = "0.0.0"
    }
} catch {
    $version = "0.0.0"
}

This was causing executables to be named GateSwitchWay-True.exe instead of GateSwitchWay-0.0.0.exe.

3. Build Tool Compatibility Issues

The workflow was using dotnet-warp which has known compatibility issues with Windows Forms applications that require administrator privileges. This often results in executables that fail to run or have missing dependencies.

4. Missing Self-Contained Configuration

The published artifacts weren't truly self-contained, potentially missing required .NET runtime components or native libraries.

Technical Solution

Replaced the dotnet-warp approach with native .NET single-file publishing:

dotnet publish GateSwitchWay.csproj \
  --configuration Release \
  --runtime win-x64 \
  --self-contained true \
  --output "publish" \
  -p:PublishSingleFile=true \
  -p:IncludeNativeLibrariesForSelfExtract=true \
  -p:PublishTrimmed=false \
  -p:AssemblyName="GateSwitchWay-$version"

Key improvements:

  • Self-contained: Includes all .NET runtime dependencies
  • Single file: Packages everything into one executable
  • Native libraries: Includes Windows-specific dependencies for network configuration
  • No trimming: Prevents reflection issues common with Windows Forms applications
  • Proper naming: Uses correct version in the executable name

Validation & Quality Assurance

Added comprehensive validation steps to catch build failures early:

  • Project structure verification
  • Compilation success checks
  • Artifact creation validation
  • File size and metadata reporting
  • Clear error messages and user instructions

Expected Results

The workflow now produces:

  • Functional executables that run properly on Windows systems
  • Self-contained artifacts requiring no additional .NET installation
  • Properly named files using correct version detection
  • Clear user instructions for downloading and running the application
  • Comprehensive error reporting when builds fail

Users can now download artifacts from GitHub Actions and run them directly on Windows systems (with administrator privileges) without any additional setup or dependency installation.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits September 7, 2025 11:41
Co-authored-by: lsd-techno <6795932+lsd-techno@users.noreply.github.com>
Co-authored-by: lsd-techno <6795932+lsd-techno@users.noreply.github.com>
Copilot AI changed the title [WIP] built artifact in actions is not functional for some reason Fix GitHub Actions workflow to produce functional artifacts Sep 7, 2025
Copilot AI requested a review from lsd-techno September 7, 2025 11:45
Copy link
Copy Markdown
Owner

@lsd-techno lsd-techno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@lsd-techno lsd-techno marked this pull request as ready for review September 7, 2025 13:34
@lsd-techno lsd-techno merged commit 6d8b01f into main Sep 7, 2025
@lsd-techno lsd-techno mentioned this pull request Sep 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants