Skip to content

Commit 6d8b01f

Browse files
authored
Merge pull request #1 from lsd-techno/copilot/fix-86bb6a9a-9d0e-47a5-b169-b10a6976d9c1
Fix GitHub Actions workflow to produce functional artifacts
2 parents 4eac0ef + 31ae24a commit 6d8b01f

2 files changed

Lines changed: 100 additions & 46 deletions

File tree

.github/workflows/publish.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: .NET 8.0 Build, Publish, and Artifact Upload
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
tags:
7+
- 'v*.*.*'
8+
9+
jobs:
10+
build:
11+
runs-on: windows-latest
12+
13+
steps:
14+
- name: Checkout Repository
15+
uses: actions/checkout@v4
16+
17+
- name: Setup .NET 8.0
18+
uses: actions/setup-dotnet@v4
19+
with:
20+
dotnet-version: '8.0.x'
21+
22+
- name: Restore Dependencies
23+
run: dotnet restore GateSwitchWay.sln
24+
25+
- name: Build Solution
26+
run: dotnet build GateSwitchWay.sln --configuration Release --no-restore
27+
28+
- name: Basic Validation
29+
run: |
30+
echo "Validating project structure and basic compilation..."
31+
# Check if key files exist
32+
if (!(Test-Path "GateSwitchWay.csproj")) { throw "Project file not found" }
33+
if (!(Test-Path "Program.cs")) { throw "Program.cs not found" }
34+
if (!(Test-Path "MainForm.cs")) { throw "MainForm.cs not found" }
35+
if (!(Test-Path "app.manifest")) { throw "Application manifest not found" }
36+
37+
# Check if built output exists
38+
if (!(Test-Path "bin\Release\net8.0-windows\GateSwitchWay.dll")) { throw "Build output not found" }
39+
40+
echo "✓ All validation checks passed"
41+
shell: pwsh
42+
43+
- name: Publish Application as Single File
44+
run: |
45+
try {
46+
$version = git describe --tags --abbrev=0 2>$null
47+
if ($LASTEXITCODE -ne 0) {
48+
$version = "0.0.0"
49+
}
50+
} catch {
51+
$version = "0.0.0"
52+
}
53+
echo "Building version: $version"
54+
55+
dotnet publish GateSwitchWay.csproj `
56+
--configuration Release `
57+
--runtime win-x64 `
58+
--self-contained true `
59+
--output "publish" `
60+
-p:PublishSingleFile=true `
61+
-p:IncludeNativeLibrariesForSelfExtract=true `
62+
-p:PublishTrimmed=false `
63+
-p:AssemblyName="GateSwitchWay-$version"
64+
65+
# Verify the executable was created
66+
$exePath = "publish\GateSwitchWay-$version.exe"
67+
if (Test-Path $exePath) {
68+
$size = (Get-Item $exePath).Length
69+
echo "Successfully created executable: $exePath (Size: $([math]::Round($size / 1MB, 2)) MB)"
70+
# Copy to root for artifact upload
71+
Copy-Item $exePath "GateSwitchWay-$version.exe"
72+
} else {
73+
echo "ERROR: Executable not found at $exePath"
74+
exit 1
75+
}
76+
shell: pwsh
77+
78+
- name: Upload Published Artifacts
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: published-artifacts
82+
path: GateSwitchWay-*.exe
83+
84+
- name: Artifact Information
85+
run: |
86+
echo "Build completed successfully!"
87+
echo "Artifact details:"
88+
Get-ChildItem "GateSwitchWay-*.exe" | ForEach-Object {
89+
$size = [math]::Round($_.Length / 1MB, 2)
90+
echo " - File: $($_.Name)"
91+
echo " - Size: $size MB"
92+
echo " - Created: $($_.CreationTime)"
93+
}
94+
echo ""
95+
echo "Download instructions:"
96+
echo "1. Go to the Actions tab in GitHub"
97+
echo "2. Click on this workflow run"
98+
echo "3. Download the 'published-artifacts' zip file"
99+
echo "4. Extract and run as Administrator (required for network configuration)"
100+
shell: pwsh

.github/workflows/publush.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)