Merge pull request 'fix-ci' (#25) from fix-ci into master
All checks were successful
CI / Test (push) Successful in 1m39s
CI / Lint (push) Successful in 1m48s
CI / Build (push) Successful in 2m57s
CI / Test (pull_request) Successful in 1m43s
CI / Lint (pull_request) Successful in 1m53s
CI / Build (pull_request) Successful in 2m50s

Reviewed-on: #25
This commit is contained in:
s1d3sw1ped
2024-05-20 07:01:22 +00:00
5 changed files with 50 additions and 15 deletions

View File

@@ -19,6 +19,11 @@ jobs:
check-latest: true check-latest: true
cache: 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 - name: Install go dependencies
run: go mod tidy run: go mod tidy
@@ -90,7 +95,7 @@ jobs:
- name: Build for linux - name: Build for linux
run: | 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: env:
VERSION: ${{github.ref_name}} VERSION: ${{github.ref_name}}
BUILD: ${{github.run_number}} BUILD: ${{github.run_number}}
@@ -102,7 +107,7 @@ jobs:
- name: Build for windows - name: Build for windows
run: | 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: env:
VERSION: ${{github.ref_name}} VERSION: ${{github.ref_name}}
BUILD: ${{github.run_number}} BUILD: ${{github.run_number}}
@@ -115,5 +120,5 @@ jobs:
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: swiped-mod-switcher-${{github.ref_name}} name: swiped-mod-switcher-${{github.ref_name}}-${{github.run_number}}
path: bin/ path: bin/

View File

@@ -20,6 +20,11 @@ jobs:
check-latest: true check-latest: true
cache: 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 - name: Install go dependencies
run: go mod tidy run: go mod tidy
@@ -91,7 +96,7 @@ jobs:
- name: Build for linux - name: Build for linux
run: | 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 ls bin
env: env:
VERSION: ${{github.ref_name}} VERSION: ${{github.ref_name}}
@@ -103,7 +108,7 @@ jobs:
- name: Build for windows - name: Build for windows
run: | 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 ls bin
env: env:
VERSION: ${{github.ref_name}} VERSION: ${{github.ref_name}}
@@ -116,5 +121,5 @@ jobs:
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: swiped-mod-switcher-${{github.ref_name}} name: swiped-mod-switcher-${{github.ref_name}}-${{github.run_number}}
path: bin/ path: bin/

View File

@@ -21,6 +21,11 @@ jobs:
check-latest: true check-latest: true
cache: 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 - name: Install go dependencies
run: go mod tidy run: go mod tidy
@@ -87,7 +92,7 @@ jobs:
- name: Build for linux - name: Build for linux
run: | run: |
fyne build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH} fyne build --release --os=${GOOS} --metadata BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}
env: env:
VERSION: ${{github.ref_name}} VERSION: ${{github.ref_name}}
BUILD: ${{github.run_number}} BUILD: ${{github.run_number}}
@@ -99,7 +104,7 @@ jobs:
- name: Build for windows - name: Build for windows
run: | run: |
fyne build --os=${GOOS} --metadata Build=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}.exe fyne build --release --os=${GOOS} --metadata BuildVersion=${VERSION} --metadata BuildNumber=${BUILD} -o bin/swiped-mod-switcher-${VERSION#v}.${BUILD}-${GOOS}-${GOARCH}.exe
env: env:
VERSION: ${{github.ref_name}} VERSION: ${{github.ref_name}}
BUILD: ${{github.run_number}} BUILD: ${{github.run_number}}

View File

@@ -2,5 +2,3 @@
Icon = "icon.png" Icon = "icon.png"
Name = "Swiped Mod Switcher" Name = "Swiped Mod Switcher"
ID = "com.s1d3sw1ped.swipedmodswitcher" ID = "com.s1d3sw1ped.swipedmodswitcher"
Version = "0.0.0"
Build = 2

32
main.go
View File

@@ -4,9 +4,9 @@ import (
"fmt" "fmt"
"os" "os"
"path/filepath" "path/filepath"
"runtime/debug"
"s1d3sw1ped/swipedmodswitcher/admin" "s1d3sw1ped/swipedmodswitcher/admin"
"slices" "slices"
"strconv"
"strings" "strings"
"fyne.io/fyne/v2" "fyne.io/fyne/v2"
@@ -18,8 +18,6 @@ import (
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
) )
var Version = ""
type Config struct { type Config struct {
ModProfilesDirectory string `yaml:"mod_profiles_dir"` ModProfilesDirectory string `yaml:"mod_profiles_dir"`
GameModsDirectory string `yaml:"game_mods_dir"` GameModsDirectory string `yaml:"game_mods_dir"`
@@ -74,7 +72,31 @@ func main() {
cfg = loadConfig() cfg = loadConfig()
ap := app.New() 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.Resize(fyne.NewSize(600, 1))
wp.CenterOnScreen() wp.CenterOnScreen()
@@ -189,6 +211,6 @@ func makeIFunc(profile, archive string, parent fyne.Window) func() {
return 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()
} }
} }