Skip to content

Commit c0f76bd

Browse files
committed
Add version to the app
1 parent e239a23 commit c0f76bd

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

.github/workflows/build-package.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ jobs:
1111
name: Build package (${{ inputs.os }})
1212
runs-on: ${{ inputs.os }}
1313
steps:
14+
- name: Extract Version Name
15+
id: extract_name
16+
uses: actions/github-script@v7
17+
with:
18+
result-encoding: string
19+
script: |
20+
if (context.payload.ref.startsWith('refs/tags/')) {
21+
return context.payload.ref.replace(/refs\/tags\/v/, '');
22+
}
23+
return 'dev';
24+
- name: Set version
25+
run: echo ${{ steps.extract_name.outputs.result }} > assets/appversion
1426
- name: Setup Go
1527
uses: actions/setup-go@v5
1628
with:

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
- name: Set version
8686
env:
8787
VERSION: ${{ steps.extract_name.outputs.result }}
88-
run: echo %VERSION% > appversion
88+
run: echo %VERSION% > assets\appversion
8989
- name: Move file
9090
run: mv LargeCsvReader.exe windows
9191
- name: Create Windows setup

assets/appversion

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

main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@ import (
1414
"fyne.io/fyne/v2/widget"
1515
"io"
1616
"os"
17+
"strings"
1718
)
1819

1920
//go:embed translation
2021
var translations embed.FS
2122

23+
//go:embed assets/appversion
24+
var version string
25+
2226
func showPreviewWindow(filePath string, fyneApp fyne.App) {
2327
window := fyneApp.NewWindow(lang.X("app.preview", "Preview"))
2428
window.Resize(fyne.NewSize(640, 480))
@@ -169,7 +173,7 @@ func main() {
169173
panic(err)
170174
}
171175

172-
window := fyneApp.NewWindow(lang.X("app.title", "Large CSV Reader"))
176+
window := fyneApp.NewWindow(lang.X("app.title", "Large CSV Reader") + " (" + strings.TrimSpace(version) + ")")
173177
window.Resize(fyne.NewSize(640, 480))
174178
window.SetMaster()
175179

0 commit comments

Comments
 (0)