Skip to content

Commit 5aca8ef

Browse files
committed
Initial release
1 parent 0466f29 commit 5aca8ef

33 files changed

Lines changed: 9223 additions & 0 deletions

.editorconfig

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# http://EditorConfig.org
2+
3+
# Top-most EditorConfig file
4+
root = true
5+
6+
# Default settings for all files
7+
[*]
8+
charset = utf-8
9+
end_of_line = crlf
10+
indent_size = 4
11+
indent_style = tab
12+
trim_trailing_whitespace = false
13+
insert_final_newline = false
14+
15+
16+
[**.cs]
17+
indent_size = 2
18+
indent_style = space
19+
trim_trailing_whitespace = true
20+
insert_final_newline = true
21+
22+
23+
[**.md]
24+
indent_size = 2
25+
indent_style = space
26+
trim_trailing_whitespace = false
27+
insert_final_newline = true
28+
29+
30+
# Solution files
31+
[**.{sln,slnf,slnx}]
32+
indent_size = 4
33+
indent_style = space
34+
trim_trailing_whitespace = true
35+
insert_final_newline = true
36+
37+
38+
# XML project files
39+
[**.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,nativeproj,locproj}]
40+
indent_size = 4
41+
indent_style = space
42+
trim_trailing_whitespace = true
43+
insert_final_newline = true
44+
45+
46+
# XML config files
47+
[**.{xml,imxml,stylecop,props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
48+
indent_size = 4
49+
indent_style = space
50+
trim_trailing_whitespace = true
51+
insert_final_newline = true
52+
53+
54+
# JSON files
55+
[**.json]
56+
indent_size = 2
57+
indent_style = space
58+
insert_final_newline = true
59+
trim_trailing_whitespace = true
60+
61+
62+
# YAML config files
63+
[**.{yml,yaml}]
64+
indent_size = 2
65+
indent_style = space
66+
insert_final_newline = true
67+
trim_trailing_whitespace = true
68+
69+
70+
# Powershell files
71+
[**.ps1]
72+
indent_size = 2
73+
indent_style = space
74+
insert_final_newline = true
75+
trim_trailing_whitespace = true
76+
77+
78+
# Shell script files
79+
[**.sh]
80+
indent_size = 2
81+
indent_style = space
82+
insert_final_newline = true
83+
trim_trailing_whitespace = true
84+
85+
86+
[**.{bat,cmd}]
87+
indent_size = 2
88+
indent_style = tab
89+
insert_final_newline = true
90+
trim_trailing_whitespace = true

.gitattributes

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
#*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
#*.sln merge=binary
26+
#*.csproj merge=binary
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
#*.jpg binary
44+
#*.png binary
45+
#*.gif binary
46+
47+
###############################################################################
48+
# diff behavior for common document formats
49+
#
50+
# Convert binary document formats to text before diffing them. This feature
51+
# is only available from the command line. Turn it on by uncommenting the
52+
# entries below.
53+
###############################################################################
54+
#*.doc diff=astextplain
55+
#*.DOC diff=astextplain
56+
#*.docx diff=astextplain
57+
#*.DOCX diff=astextplain
58+
#*.dot diff=astextplain
59+
#*.DOT diff=astextplain
60+
#*.pdf diff=astextplain
61+
#*.PDF diff=astextplain
62+
#*.rtf diff=astextplain
63+
#*.RTF diff=astextplain
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
name: Build & Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "Version to publish (e.g. 1.0.0)"
8+
required: true
9+
type: string
10+
11+
push:
12+
tags:
13+
- "v*.*.*"
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
build:
20+
name: Build Windows Binary
21+
runs-on: windows-latest # WindowsDesktop.App.WindowsForms requires Windows
22+
permissions:
23+
contents: write
24+
25+
env:
26+
DOTNET_CLI_TELEMETRY_OPTOUT: true
27+
DOTNET_NOLOGO: true
28+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
29+
30+
steps:
31+
- name: Checkout repository (with full history)
32+
uses: actions/checkout@v6
33+
with:
34+
fetch-depth: 0 # Full history needed for changelog
35+
submodules: recursive
36+
37+
- name: Setup .NET SDK
38+
uses: actions/setup-dotnet@v5
39+
with:
40+
dotnet-version: "10.0.x"
41+
cache: true
42+
cache-dependency-path: "**/ghb.csproj"
43+
44+
- name: Determine version (manual dispatch)
45+
if: ${{ github.event_name == 'workflow_dispatch' }}
46+
shell: bash
47+
run: |
48+
TAG="v${{ github.event.inputs.version }}"
49+
echo "TAG=$TAG" >> $GITHUB_ENV
50+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
51+
52+
- name: Determine version (tag push)
53+
if: ${{ github.event_name == 'push' }}
54+
shell: bash
55+
run: |
56+
TAG="${{ github.ref_name }}"
57+
VERSION="${TAG#v}"
58+
echo "TAG=$TAG" >> $GITHUB_ENV
59+
echo "VERSION=$VERSION" >> $GITHUB_ENV
60+
61+
- name: Restore dependencies
62+
run: dotnet restore --no-cache
63+
64+
- name: Build solution
65+
run: dotnet build -c Release --no-restore --no-incremental
66+
67+
- name: Publish self-contained executable
68+
run: |
69+
dotnet publish ghb/ghb.csproj -c Release `
70+
--self-contained true `
71+
-r win-x64 `
72+
-p:PublishSingleFile=true `
73+
-p:IncludeNativeLibrariesForSelfExtract=true
74+
75+
- name: Generate changelog
76+
id: changelog
77+
shell: bash
78+
run: |
79+
# Get the previous tag for comparison
80+
PREV_TAG=$(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || echo "")
81+
82+
if [ -z "$PREV_TAG" ]; then
83+
# First release - get all commits
84+
echo "## What's Changed" > CHANGELOG.md
85+
echo "" >> CHANGELOG.md
86+
git log --pretty=format:"* %s by @%an in %h" --no-merges >> CHANGELOG.md
87+
else
88+
# Get commits since previous tag
89+
echo "## What's Changed" > CHANGELOG.md
90+
echo "" >> CHANGELOG.md
91+
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${{ env.TAG }}" >> CHANGELOG.md
92+
echo "" >> CHANGELOG.md
93+
echo "### Commits" >> CHANGELOG.md
94+
echo "" >> CHANGELOG.md
95+
git log ${PREV_TAG}..HEAD --pretty=format:"* %s by @%an in %h" --no-merges >> CHANGELOG.md
96+
fi
97+
98+
echo "" >> CHANGELOG.md
99+
echo "### SHA256 Checksums" >> CHANGELOG.md
100+
echo "\`\`\`" >> CHANGELOG.md
101+
102+
# Show the changelog for debugging
103+
cat CHANGELOG.md
104+
105+
- name: Create release artifacts
106+
shell: powershell
107+
run: |
108+
New-Item -ItemType Directory -Force -Path "dist"
109+
110+
# 1. Framework-dependent build (from bin folder)
111+
$binPath = Resolve-Path "./bin"
112+
$frameworkZip = "dist/ghb-${{ env.VERSION }}-framework-dependent.zip"
113+
Compress-Archive -Path "$binPath\*" -DestinationPath $frameworkZip -Force
114+
Write-Host "Created framework-dependent zip: $frameworkZip"
115+
116+
# 2. Self-contained single-file executable (from publish folder)
117+
$sourceExe = "./publish/ghb.exe"
118+
$destExe = "dist/ghb-${{ env.VERSION }}-win-x64.exe"
119+
if (Test-Path $sourceExe) {
120+
Copy-Item $sourceExe $destExe
121+
Write-Host "Copied self-contained executable: $destExe"
122+
} else {
123+
Write-Error "Publish output not found at $sourceExe"
124+
exit 1
125+
}
126+
127+
# 3. Also zip the self-contained executable for convenience
128+
$selfContainedZip = "dist/ghb-${{ env.VERSION }}-win-x64-self-contained.zip"
129+
Compress-Archive -Path $destExe -DestinationPath $selfContainedZip -Force
130+
Write-Host "Created self-contained zip: $selfContainedZip"
131+
132+
# List artifacts
133+
Get-ChildItem dist/
134+
135+
- name: Generate checksums
136+
shell: bash
137+
run: |
138+
cd dist
139+
sha256sum *.exe *.zip > checksums.txt
140+
cat checksums.txt
141+
cd ..
142+
cat dist/checksums.txt >> CHANGELOG.md
143+
echo "\`\`\`" >> CHANGELOG.md
144+
145+
- name: Upload artifacts
146+
uses: actions/upload-artifact@v4
147+
with:
148+
name: ghb-${{ env.VERSION }}
149+
path: dist/
150+
retention-days: 30
151+
152+
- name: Create GitHub Release
153+
uses: softprops/action-gh-release@v2
154+
with:
155+
tag_name: ${{ env.TAG }}
156+
name: "ghb ${{ env.VERSION }}"
157+
body_path: CHANGELOG.md
158+
draft: false
159+
prerelease: ${{ contains(env.TAG, '-') || contains(env.TAG, 'alpha') || contains(env.TAG, 'beta') || contains(env.TAG, 'rc') }}
160+
files: |
161+
dist/*
162+
env:
163+
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)