From 7863c53280cdda1732d89a5931897b47c5b2b18f Mon Sep 17 00:00:00 2001 From: Justin Harms Date: Mon, 20 May 2024 00:35:08 -0500 Subject: [PATCH 1/5] test --- main.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main.go b/main.go index 343ee9d..4c9b2f3 100644 --- a/main.go +++ b/main.go @@ -18,8 +18,6 @@ import ( "gopkg.in/yaml.v3" ) -var Version = "" - type Config struct { ModProfilesDirectory string `yaml:"mod_profiles_dir"` GameModsDirectory string `yaml:"game_mods_dir"` @@ -189,6 +187,6 @@ func makeIFunc(profile, archive string, parent fyne.Window) func() { return } - dialog.NewInformation("Success", fmt.Sprintf("filinked files from %s to %s", filepath.Base(profile), archive), parent).Show() + dialog.NewInformation("Success", fmt.Sprintf("linked files from %s to %s", filepath.Base(profile), archive), parent).Show() } } From 1af4d225b585d5f3bf72b96a4f85e64e96515cc3 Mon Sep 17 00:00:00 2001 From: Justin Harms Date: Mon, 20 May 2024 00:47:05 -0500 Subject: [PATCH 2/5] add os dependencies to lint --- .gitea/workflows/pull-request-ci.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitea/workflows/pull-request-ci.yaml b/.gitea/workflows/pull-request-ci.yaml index 8fe8959..557094a 100644 --- a/.gitea/workflows/pull-request-ci.yaml +++ b/.gitea/workflows/pull-request-ci.yaml @@ -19,6 +19,11 @@ jobs: check-latest: true cache: true + - name: Setup OS dependencies + run: | + apt-get update + apt-get install -y gcc-mingw-w64 gcc libgl1-mesa-dev xorg-dev + - name: Install go dependencies run: go mod tidy From 1f0948295093f10eb42db230ffb57bfcf4c8966d Mon Sep 17 00:00:00 2001 From: Justin Harms Date: Mon, 20 May 2024 01:00:32 -0500 Subject: [PATCH 3/5] remove version and build from fyneapp.toml --- FyneApp.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/FyneApp.toml b/FyneApp.toml index 4e77148..2b5d28e 100644 --- a/FyneApp.toml +++ b/FyneApp.toml @@ -2,5 +2,3 @@ Icon = "icon.png" Name = "Swiped Mod Switcher" ID = "com.s1d3sw1ped.swipedmodswitcher" - Version = "0.0.0" - Build = 2 From 83cb34001fe829242b5eeff704462937a6939835 Mon Sep 17 00:00:00 2001 From: Justin Harms Date: Mon, 20 May 2024 01:37:58 -0500 Subject: [PATCH 4/5] fyne metadata sucks so jst custom stuff --- .gitea/workflows/pull-request-ci.yaml | 4 ++-- .gitea/workflows/push-ci.yaml | 4 ++-- .gitea/workflows/tag-release.yaml | 4 ++-- main.go | 28 +++++++++++++++++++++++++-- 4 files changed, 32 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/pull-request-ci.yaml b/.gitea/workflows/pull-request-ci.yaml index 557094a..60e9651 100644 --- a/.gitea/workflows/pull-request-ci.yaml +++ b/.gitea/workflows/pull-request-ci.yaml @@ -95,7 +95,7 @@ jobs: - name: Build for linux run: | - fyne build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH} + fyne build --os=${GOOS} --metadata BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH} env: VERSION: ${{github.ref_name}} BUILD: ${{github.run_number}} @@ -107,7 +107,7 @@ jobs: - name: Build for windows run: | - fyne build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}.exe + fyne build --os=${GOOS} --metadata BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH}.exe env: VERSION: ${{github.ref_name}} BUILD: ${{github.run_number}} diff --git a/.gitea/workflows/push-ci.yaml b/.gitea/workflows/push-ci.yaml index 8187c99..6ef8b0c 100644 --- a/.gitea/workflows/push-ci.yaml +++ b/.gitea/workflows/push-ci.yaml @@ -91,7 +91,7 @@ jobs: - name: Build for linux run: | - fyne build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH} + fyne build --os=${GOOS} --metadata BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH} ls bin env: VERSION: ${{github.ref_name}} @@ -103,7 +103,7 @@ jobs: - name: Build for windows run: | - fyne build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}.exe + fyne build --os=${GOOS} --metadata BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH}.exe ls bin env: VERSION: ${{github.ref_name}} diff --git a/.gitea/workflows/tag-release.yaml b/.gitea/workflows/tag-release.yaml index bdffbe6..5fa4b7a 100644 --- a/.gitea/workflows/tag-release.yaml +++ b/.gitea/workflows/tag-release.yaml @@ -87,7 +87,7 @@ jobs: - name: Build for linux run: | - fyne build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH} + fyne build --os=${GOOS} --metadata BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH} env: VERSION: ${{github.ref_name}} BUILD: ${{github.run_number}} @@ -99,7 +99,7 @@ jobs: - name: Build for windows run: | - fyne build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}.exe + fyne build --os=${GOOS} --metadata BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}.exe env: VERSION: ${{github.ref_name}} BUILD: ${{github.run_number}} diff --git a/main.go b/main.go index 4c9b2f3..135c6bd 100644 --- a/main.go +++ b/main.go @@ -4,9 +4,9 @@ import ( "fmt" "os" "path/filepath" + "runtime/debug" "s1d3sw1ped/swipedmodswitcher/admin" "slices" - "strconv" "strings" "fyne.io/fyne/v2" @@ -72,7 +72,31 @@ func main() { cfg = loadConfig() ap := app.New() - wp := ap.NewWindow(ap.Metadata().Name + " v" + ap.Metadata().Version + "." + strconv.Itoa(ap.Metadata().Build)) + + commithash := func() string { + if info, ok := debug.ReadBuildInfo(); ok { + for _, setting := range info.Settings { + if setting.Key == "vcs.revision" { + return setting.Value + } + } + } + return "" + }() + + buildversion := ap.Metadata().Custom["BuildVersion"] + if buildversion == "" { + buildversion = "" + } + + buildnumber := ap.Metadata().Custom["BuildNumber"] + if buildnumber == "" { + buildnumber = "commit " + commithash + } else { + buildnumber = "build " + buildnumber + } + + wp := ap.NewWindow(ap.Metadata().Name + " " + buildversion + " " + buildnumber) wp.Resize(fyne.NewSize(600, 1)) wp.CenterOnScreen() From 4cbb0666cbdd9b00fe4277531d34445dd6b97126 Mon Sep 17 00:00:00 2001 From: Justin Harms Date: Mon, 20 May 2024 01:47:36 -0500 Subject: [PATCH 5/5] add run number to artifacts --- .gitea/workflows/pull-request-ci.yaml | 2 +- .gitea/workflows/push-ci.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/pull-request-ci.yaml b/.gitea/workflows/pull-request-ci.yaml index 60e9651..0261cab 100644 --- a/.gitea/workflows/pull-request-ci.yaml +++ b/.gitea/workflows/pull-request-ci.yaml @@ -120,5 +120,5 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: swiped-mod-switcher-${{github.ref_name}} + name: swiped-mod-switcher-${{github.ref_name}}-${{github.run_number}} path: bin/ \ No newline at end of file diff --git a/.gitea/workflows/push-ci.yaml b/.gitea/workflows/push-ci.yaml index 6ef8b0c..38abfff 100644 --- a/.gitea/workflows/push-ci.yaml +++ b/.gitea/workflows/push-ci.yaml @@ -116,5 +116,5 @@ jobs: - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: swiped-mod-switcher-${{github.ref_name}} + name: swiped-mod-switcher-${{github.ref_name}}-${{github.run_number}} path: bin/ \ No newline at end of file