Skip to content

Commit dffa8dc

Browse files
jaredthirskclaude
andcommitted
Fix GitHub Actions workflow and add version management
- Fix version reading in workflow (trim whitespace) - Replace deprecated create-release action with GitHub CLI - Add proper permissions for release creation - Add centralized version management with VERSION file - Create version bump script for easy releases - Update RELEASING.md with complete instructions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8970a26 commit dffa8dc

File tree

6 files changed

+277
-53
lines changed

6 files changed

+277
-53
lines changed

.github/workflows/build.yml

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ jobs:
1717
- name: Checkout code
1818
uses: actions/checkout@v4
1919

20+
- name: Get version
21+
id: version
22+
run: |
23+
$version = (Get-Content VERSION -Raw).Trim()
24+
echo "VERSION=$version" >> $env:GITHUB_OUTPUT
25+
echo "Building HudClock v$version"
26+
shell: pwsh
27+
2028
- name: Setup .NET
2129
uses: actions/setup-dotnet@v4
2230
with:
@@ -87,53 +95,44 @@ jobs:
8795
needs: build
8896
runs-on: ubuntu-latest
8997
if: startsWith(github.ref, 'refs/tags/v')
98+
permissions:
99+
contents: write
90100

91101
steps:
102+
- name: Checkout code
103+
uses: actions/checkout@v4
104+
92105
- name: Download artifacts
93106
uses: actions/download-artifact@v4
94107
with:
95108
name: hudclock-builds
96109
path: artifacts
97110

98111
- name: Create Release
99-
id: create_release
100-
uses: actions/create-release@v1
101112
env:
102113
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103-
with:
104-
tag_name: ${{ github.ref }}
105-
release_name: HudClock ${{ github.ref }}
106-
draft: false
107-
prerelease: false
108-
body: |
109-
## Download Options
110-
111-
### 🚀 Recommended: Self-Contained Version
112-
**[HudClock-win-x64-self-contained.zip]** - Single executable file that includes everything needed to run. No installation or .NET runtime required. Just download, extract, and run!
113-
114-
### 📦 Other Options
115-
- **[HudClock-win-x64-framework-dependent.zip]** - Smaller single executable (requires .NET 8 Desktop Runtime)
116-
- **[HudClock-win-x64-portable.zip]** - Traditional portable app with multiple files
117-
118-
## System Requirements
119-
- Windows 10 or later (64-bit)
120-
- .NET 8 Desktop Runtime (only for framework-dependent version)
121-
122-
## Installation
123-
1. Download your preferred version
124-
2. Extract the ZIP file to any location
125-
3. Run `HudClock.exe`
126-
4. (Optional) Create a shortcut for easy access
127-
128-
## What's New
129-
See [commits](https://github.com/lionfire/hudclock/commits/${{ github.ref }}) for details.
130-
131-
- name: Upload Release Assets
132114
run: |
133-
for file in artifacts/*.zip; do
134-
asset_name=$(basename "$file")
135-
echo "Uploading $asset_name..."
136-
gh release upload "${{ github.ref_name }}" "$file" --clobber
137-
done
138-
env:
139-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115+
gh release create "${{ github.ref_name }}" \
116+
--title "HudClock ${{ github.ref_name }}" \
117+
--notes "## Download Options
118+
119+
### 🚀 Recommended: Self-Contained Version
120+
**HudClock-win-x64-self-contained.zip** - Single executable file that includes everything needed to run. No installation or .NET runtime required. Just download, extract, and run!
121+
122+
### 📦 Other Options
123+
- **HudClock-win-x64-framework-dependent.zip** - Smaller single executable (requires .NET 8 Desktop Runtime)
124+
- **HudClock-win-x64-portable.zip** - Traditional portable app with multiple files
125+
126+
## System Requirements
127+
- Windows 10 or later (64-bit)
128+
- .NET 8 Desktop Runtime (only for framework-dependent version)
129+
130+
## Installation
131+
1. Download your preferred version
132+
2. Extract the ZIP file to any location
133+
3. Run \`HudClock.exe\`
134+
4. (Optional) Create a shortcut for easy access
135+
136+
## What's New
137+
See [commits](https://github.com/lionfire/hudclock/commits/${{ github.ref_name }}) for details." \
138+
artifacts/*.zip

Directory.Build.props

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project>
2+
<PropertyGroup>
3+
<!-- Read version from VERSION file -->
4+
<VersionPrefix>$([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)VERSION').Trim())</VersionPrefix>
5+
<FileVersion>$(VersionPrefix).0</FileVersion>
6+
<AssemblyVersion>$(VersionPrefix).0</AssemblyVersion>
7+
8+
<!-- Common properties for all projects -->
9+
<Product>HudClock</Product>
10+
<Company>LionFire</Company>
11+
<Copyright>Copyright © 2025 LionFire</Copyright>
12+
13+
<!-- Source control -->
14+
<RepositoryUrl>https://github.com/lionfire/hudclock</RepositoryUrl>
15+
<RepositoryType>git</RepositoryType>
16+
</PropertyGroup>
17+
</Project>

RELEASING.md

Lines changed: 111 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,115 @@
1-
For Automated Releases:
1+
# Releasing HudClock
22

3-
1. Push your code to GitHub
4-
2. Create a tag: git tag v1.0.0 && git push origin v1.0.0
5-
3. GitHub Actions will automatically create a release with all packages
3+
## Version Management
64

7-
For Local Testing:
5+
HudClock uses a centralized version management system:
6+
- Version is stored in `/VERSION` file (e.g., `1.0.0`)
7+
- `Directory.Build.props` reads this version for all projects
8+
- No need to update version in multiple places
89

9-
# Quick self-contained build
10-
dotnet publish src/wpf/MetricClock.csproj -c Release -r win-x64 --self-contained -p:PublishSingleFile=true
10+
### Current Version
11+
Check the current version:
12+
```bash
13+
cat VERSION
14+
```
1115

12-
# Or use the installer script
13-
.\build\create-installer.ps1 -Version 1.0.0
14-
16+
## Creating a Release
17+
18+
### Option 1: Automated Release (Recommended)
19+
20+
Use the version bump script:
21+
```powershell
22+
# Bump patch version (1.0.0 -> 1.0.1)
23+
.\build\bump-version.ps1 -BumpType patch -CreateTag -Push
24+
25+
# Bump minor version (1.0.0 -> 1.1.0)
26+
.\build\bump-version.ps1 -BumpType minor -CreateTag -Push
27+
28+
# Bump major version (1.0.0 -> 2.0.0)
29+
.\build\bump-version.ps1 -BumpType major -CreateTag -Push
30+
```
31+
32+
This will:
33+
1. Update the VERSION file
34+
2. Test build with new version
35+
3. Commit the change
36+
4. Create an annotated tag (e.g., `v1.0.1`)
37+
5. Push everything to GitHub
38+
6. Trigger GitHub Actions to create the release
39+
40+
### Option 2: Manual Release
41+
42+
1. **Update version**:
43+
```bash
44+
echo "1.0.1" > VERSION
45+
```
46+
47+
2. **Commit version change**:
48+
```bash
49+
git add VERSION
50+
git commit -m "Bump version to 1.0.1"
51+
```
52+
53+
3. **Create and push tag**:
54+
```bash
55+
git tag -a v1.0.1 -m "Release v1.0.1"
56+
git push
57+
git push origin v1.0.1
58+
```
59+
60+
## GitHub Actions Workflow
61+
62+
When you push a tag starting with `v`, the workflow will:
63+
1. Build the application
64+
2. Create multiple package types:
65+
- Self-contained single EXE (~150MB, no .NET required)
66+
- Framework-dependent single EXE (~1MB, requires .NET 8)
67+
- Portable ZIP with multiple files
68+
3. Create a GitHub Release
69+
4. Upload all packages as release assets
70+
71+
## Local Testing
72+
73+
### Build single-file executable:
74+
```powershell
75+
# Self-contained (no .NET required)
76+
dotnet publish src/wpf/MetricClock.csproj -c Release -r win-x64 --self-contained -p:PublishSingleFile=true
77+
78+
# Framework-dependent (requires .NET 8)
79+
dotnet publish src/wpf/MetricClock.csproj -c Release -r win-x64 --no-self-contained -p:PublishSingleFile=true
80+
```
81+
82+
### Create installer:
83+
```powershell
84+
.\build\create-installer.ps1 -Version $(Get-Content VERSION)
85+
```
86+
87+
## Release Checklist
88+
89+
Before releasing:
90+
- [ ] All changes committed and pushed
91+
- [ ] Application builds without errors
92+
- [ ] Tested on Windows 10/11
93+
- [ ] Updated documentation if needed
94+
- [ ] Decided on version bump type (major/minor/patch)
95+
96+
## Version Numbering
97+
98+
HudClock follows [Semantic Versioning](https://semver.org/):
99+
- **Major** (X.0.0): Breaking changes
100+
- **Minor** (1.X.0): New features, backward compatible
101+
- **Patch** (1.0.X): Bug fixes, backward compatible
102+
103+
## Monitoring Releases
104+
105+
- **GitHub Actions**: https://github.com/lionfire/hudclock/actions
106+
- **Releases Page**: https://github.com/lionfire/hudclock/releases
107+
- **Latest Release**: https://github.com/lionfire/hudclock/releases/latest
108+
109+
## Troubleshooting
110+
111+
If a release fails:
112+
1. Check GitHub Actions logs
113+
2. Ensure version format is correct (X.Y.Z)
114+
3. Verify tag starts with 'v' (e.g., v1.0.0)
115+
4. Check file permissions and .NET SDK version

VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.0.0

build/bump-version.ps1

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Script to bump version numbers for HudClock
2+
param(
3+
[Parameter(Mandatory=$true)]
4+
[ValidateSet("major", "minor", "patch")]
5+
[string]$BumpType,
6+
7+
[switch]$CreateTag,
8+
[switch]$Push
9+
)
10+
11+
$ErrorActionPreference = "Stop"
12+
13+
# Read current version
14+
$versionFile = Join-Path $PSScriptRoot "..\VERSION"
15+
$currentVersion = (Get-Content $versionFile).Trim()
16+
$versionParts = $currentVersion.Split('.')
17+
18+
if ($versionParts.Count -ne 3) {
19+
throw "Invalid version format. Expected X.Y.Z"
20+
}
21+
22+
$major = [int]$versionParts[0]
23+
$minor = [int]$versionParts[1]
24+
$patch = [int]$versionParts[2]
25+
26+
# Bump version
27+
switch ($BumpType) {
28+
"major" {
29+
$major++
30+
$minor = 0
31+
$patch = 0
32+
}
33+
"minor" {
34+
$minor++
35+
$patch = 0
36+
}
37+
"patch" {
38+
$patch++
39+
}
40+
}
41+
42+
$newVersion = "$major.$minor.$patch"
43+
44+
Write-Host "Bumping version from $currentVersion to $newVersion" -ForegroundColor Green
45+
46+
# Update VERSION file
47+
$newVersion | Out-File -FilePath $versionFile -NoNewline -Encoding UTF8
48+
49+
# Test build to ensure version is valid
50+
Write-Host "Testing build with new version..." -ForegroundColor Yellow
51+
$buildResult = & dotnet build "$PSScriptRoot\..\src\wpf\MetricClock.csproj" --configuration Release 2>&1
52+
if ($LASTEXITCODE -ne 0) {
53+
# Revert on failure
54+
$currentVersion | Out-File -FilePath $versionFile -NoNewline -Encoding UTF8
55+
throw "Build failed with new version. Version reverted to $currentVersion"
56+
}
57+
58+
Write-Host "Build successful!" -ForegroundColor Green
59+
60+
# Git operations
61+
if ($CreateTag -or $Push) {
62+
# Commit version change
63+
git add "$versionFile"
64+
git commit -m "Bump version to $newVersion"
65+
66+
if ($CreateTag) {
67+
Write-Host "Creating tag v$newVersion..." -ForegroundColor Yellow
68+
69+
# Generate release notes (you can customize this)
70+
$releaseNotes = @"
71+
Release v$newVersion
72+
73+
[Changes since v$currentVersion](https://github.com/lionfire/hudclock/compare/v$currentVersion...v$newVersion)
74+
"@
75+
76+
git tag -a "v$newVersion" -m "$releaseNotes"
77+
Write-Host "Tag v$newVersion created" -ForegroundColor Green
78+
}
79+
80+
if ($Push) {
81+
Write-Host "Pushing to remote..." -ForegroundColor Yellow
82+
git push
83+
if ($CreateTag) {
84+
git push origin "v$newVersion"
85+
}
86+
Write-Host "Pushed successfully!" -ForegroundColor Green
87+
}
88+
}
89+
90+
Write-Host @"
91+
92+
Version bumped to $newVersion
93+
94+
Next steps:
95+
"@ -ForegroundColor Cyan
96+
97+
if (-not $CreateTag) {
98+
Write-Host " - Create tag: git tag -a v$newVersion -m 'Release v$newVersion'" -ForegroundColor Yellow
99+
}
100+
if (-not $Push) {
101+
Write-Host " - Push changes: git push" -ForegroundColor Yellow
102+
if ($CreateTag) {
103+
Write-Host " - Push tag: git push origin v$newVersion" -ForegroundColor Yellow
104+
}
105+
}
106+
107+
Write-Host @"
108+
- Monitor CI/CD: https://github.com/lionfire/hudclock/actions
109+
- View releases: https://github.com/lionfire/hudclock/releases
110+
"@ -ForegroundColor Yellow

src/wpf/MetricClock.csproj

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@
1111
<!-- Application Info -->
1212
<AssemblyName>HudClock</AssemblyName>
1313
<ApplicationIcon>HudClock.ico</ApplicationIcon>
14-
<Product>HudClock</Product>
15-
<Company>LionFire</Company>
16-
<Copyright>Copyright © 2025 LionFire</Copyright>
17-
<Version>1.0.0</Version>
18-
<FileVersion>1.0.0.0</FileVersion>
14+
<!-- Version and company info inherited from Directory.Build.props -->
1915

2016
<!-- Publishing Settings -->
2117
<PublishSingleFile>false</PublishSingleFile>

0 commit comments

Comments
 (0)