-
-
Notifications
You must be signed in to change notification settings - Fork 103
328 lines (267 loc) · 10.3 KB
/
build.yml
File metadata and controls
328 lines (267 loc) · 10.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
name: Build BabySmash
on:
push:
tags:
- 'v*'
branches:
- '**'
pull_request:
branches:
- main
- master
workflow_dispatch:
permissions:
contents: write
jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v4
with:
versionSpec: '6.4.x'
- name: GitVersion
uses: gittools/actions/gitversion/execute@v4
id: gitversion
- name: Set version environment variable
run: |
VERSION="${{ steps.gitversion.outputs.semVer }}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Using version: $VERSION"
- name: Restore dependencies
run: dotnet restore BabySmash.Linux/BabySmash.Linux.csproj
- name: Build
run: dotnet build BabySmash.Linux/BabySmash.Linux.csproj -c Release --no-restore
- name: Publish Linux x64
run: |
dotnet publish BabySmash.Linux/BabySmash.Linux.csproj \
-c Release \
-r linux-x64 \
-p:DebugType=None \
-p:DebugSymbols=false \
-p:PublishSingleFile=true \
--self-contained
- name: Install nfpm
run: |
echo "Installing nfpm..."
go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest
echo "$HOME/go/bin" >> $GITHUB_PATH
- name: Verify nfpm installation
run: nfpm --version
- name: Create .deb package
run: |
mkdir -p artifacts
nfpm package --packager deb --target artifacts/
env:
VERSION: ${{ steps.gitversion.outputs.semVer }}
- name: Create .rpm package
run: |
nfpm package --packager rpm --target artifacts/
env:
VERSION: ${{ steps.gitversion.outputs.semVer }}
- name: Prepare Linux tarball
run: |
# Also create tarball for users who prefer it
mkdir -p temp-linux
cp BabySmash.Linux/bin/Release/net10.0/linux-x64/publish/BabySmash.Linux temp-linux/babysmash
cp BabySmash.Linux/babysmash.desktop temp-linux/
cp Shared/Resources/babysmash.png temp-linux/
cp README.md temp-linux/
chmod +x temp-linux/babysmash
tar -czvf artifacts/BabySmash-linux-x64.tar.gz -C temp-linux .
rm -rf temp-linux
- name: Upload Linux artifacts
uses: actions/upload-artifact@v7
with:
name: BabySmash-Linux
path: artifacts/*
build-windows-check:
runs-on: windows-latest
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Restore dependencies
run: dotnet restore BabySmash.csproj
- name: Build
run: dotnet build BabySmash.csproj -c Release --no-restore
build-windows:
runs-on: windows-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'
- name: Restore dependencies
run: dotnet restore BabySmash.csproj
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v4
with:
versionSpec: '6.4.x'
- name: GitVersion
uses: gittools/actions/gitversion/execute@v4
id: gitversion
- name: Set version environment variables
shell: pwsh
run: |
$version = '${{ steps.gitversion.outputs.semVer }}'
$fullVersion = '${{ steps.gitversion.outputs.fullSemVer }}'
$assemblyVersion = "${{ steps.gitversion.outputs.major }}.${{ steps.gitversion.outputs.minor }}.${{ steps.gitversion.outputs.patch }}.0"
Write-Host "SemVer: $version"
Write-Host "FullSemVer: $fullVersion"
Write-Host "AssemblyVersion: $assemblyVersion"
echo "VERSION=$version" >> $env:GITHUB_ENV
echo "FULLVERSION=$fullVersion" >> $env:GITHUB_ENV
echo "ASSEMBLY_VERSION=$assemblyVersion" >> $env:GITHUB_ENV
- name: Build
run: dotnet build BabySmash.csproj -c Release --no-restore
- name: Publish x64
run: |
dotnet publish BabySmash.csproj `
-c Release `
-r win-x64 `
/p:DebugType=None `
/p:DebugSymbols=false `
/p:Version=$env:VERSION `
/p:AssemblyVersion=$env:ASSEMBLY_VERSION `
/p:FileVersion=$env:ASSEMBLY_VERSION `
/p:AssemblyInformationalVersion=$env:FULLVERSION `
--self-contained
- name: Azure Login
uses: azure/login@v2
with:
creds: '{"clientId":"${{ secrets.AZURE_CLIENT_ID }}","clientSecret":"${{ secrets.AZURE_CLIENT_SECRET }}","subscriptionId":"${{ secrets.AZURE_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.AZURE_TENANT_ID }}"}'
- name: Sign executable with Trusted Signing
uses: azure/trusted-signing-action@v1
with:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
endpoint: https://wus2.codesigning.azure.net/
signing-account-name: hanselman
certificate-profile-name: WindowsEdgeLight
files-folder: ${{ github.workspace }}\bin\Release\net10.0-windows\win-x64\publish
files-folder-filter: exe
file-digest: SHA256
timestamp-rfc3161: http://timestamp.acs.microsoft.com
timestamp-digest: SHA256
- name: Install Inno Setup
shell: pwsh
run: |
choco install innosetup -y --no-progress
echo "C:\Program Files (x86)\Inno Setup 6" >> $env:GITHUB_PATH
- name: Build Installer
shell: pwsh
run: |
# Copy signed exe to publish folder for installer
New-Item -ItemType Directory -Path publish -Force
Copy-Item "bin/Release/net10.0-windows/win-x64/publish/BabySmash.exe" -Destination "publish/"
# Compile installer with version
iscc "/DMyAppVersion=$env:VERSION" installer.iss
- name: Sign Installer with Trusted Signing
uses: azure/trusted-signing-action@v1
with:
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-client-id: ${{ secrets.AZURE_CLIENT_ID }}
azure-client-secret: ${{ secrets.AZURE_CLIENT_SECRET }}
endpoint: https://wus2.codesigning.azure.net/
signing-account-name: hanselman
certificate-profile-name: WindowsEdgeLight
files-folder: ${{ github.workspace }}\Output
files-folder-filter: exe
file-digest: SHA256
timestamp-rfc3161: http://timestamp.acs.microsoft.com
timestamp-digest: SHA256
- name: Prepare artifacts
shell: pwsh
run: |
New-Item -ItemType Directory -Path artifacts -Force
$version = $env:VERSION
# Copy installer with consistent name (for direct download links)
Copy-Item "Output/BabySmash-Setup.exe" -Destination "artifacts/BabySmash-Setup.exe"
# Create portable ZIP with exe and README
# Updatum looks for "win-x64" in asset name by default (AssetRegexPattern)
New-Item -ItemType Directory -Path "temp-x64" -Force
Copy-Item "bin/Release/net10.0-windows/win-x64/publish/BabySmash.exe" -Destination "temp-x64/"
Copy-Item "README.md" -Destination "temp-x64/"
Compress-Archive -Path "temp-x64/*" -DestinationPath "artifacts/BabySmash-win-x64.zip"
Remove-Item "temp-x64" -Recurse -Force
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: BabySmash-Windows
path: artifacts/*
create-release:
runs-on: ubuntu-latest
needs: [build-linux, build-windows]
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download Linux artifacts
uses: actions/download-artifact@v8
with:
name: BabySmash-Linux
path: artifacts/
- name: Download Windows artifacts
uses: actions/download-artifact@v8
with:
name: BabySmash-Windows
path: artifacts/
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
generate_release_notes: true
body: |
## BabySmash! ${{ github.ref_name }}
A game for babies who like to bang on the keyboard!
### 📦 Download
| File | Description |
|------|-------------|
| `BabySmash-Setup.exe` | **Windows** - Installer with Start Menu shortcut |
| `BabySmash-win-x64.zip` | **Windows** - Portable version (also used by auto-updater) |
| `babysmash_*_amd64.deb` | **Debian/Ubuntu** - Install with `sudo dpkg -i babysmash_*_amd64.deb` |
| `babysmash-*.x86_64.rpm` | **Fedora/RHEL** - Install with `sudo rpm -i babysmash-*.x86_64.rpm` |
| `BabySmash-linux-x64.tar.gz` | **Linux** - Manual install, extract and run `./babysmash` |
**Self-contained** - No .NET installation required.
### ⌨️ Usage
- Press keys and watch shapes and letters appear!
- `Alt+O` - Options (Linux) / `Ctrl+Shift+Alt+O` - Options (Windows)
- `Escape` - Exit (Linux) / `Alt+F4` - Exit (Windows)
### 🐧 Linux Package Installation
**Debian/Ubuntu:**
```bash
sudo dpkg -i babysmash_*_amd64.deb
sudo apt-get install -f # Install dependencies if needed
```
**Fedora/RHEL:**
```bash
sudo rpm -i babysmash-*.x86_64.rpm
```
After installation, BabySmash will appear in your application menu!
### 🐧 Linux Dependencies
- `espeak` for text-to-speech
- `pulseaudio-utils` or `alsa-utils` for audio
These are automatically installed when using .deb or .rpm packages.
---
append_body: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}