From a00db0aa06357f8ee72e48fb557e05561ebb5af8 Mon Sep 17 00:00:00 2001
From: charlie-haley <27928201+charlie-haley@users.noreply.github.com>
Date: Sun, 9 May 2021 17:26:33 +0100
Subject: [PATCH] Add keep-alive to vue router && populate version number from
build ldflags (#26)
* add keep-alive to vue-router
* use ldflags to populate appver
* add ldflags to build
---
.github/workflows/release.yml | 6 +++---
src/flowcontrol/frontend/src/App.vue | 4 +++-
src/flowcontrol/frontend/src/pages/Settings.vue | 13 ++++++++++++-
src/flowcontrol/go.mod | 2 +-
src/flowcontrol/go.sum | 4 ++--
src/flowcontrol/main.go | 7 +++++++
6 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index e1e400b..1c8ac0f 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -38,7 +38,7 @@ jobs:
if: ${{ !env.ACT }}
run: |
cd ./src/flowcontrol
- wails build -x windows/amd64 --verbose
+ wails build -x windows/amd64 --verbose -ldflags="-X 'main.appver=${{ github.ref }}'"
# If building locally, ensure we don't compile for a specific architecture due to docker in docker requirements
- name: Build project
if: ${{ env.ACT }}
@@ -113,7 +113,7 @@ jobs:
if: ${{ !env.ACT }}
run: |
cd ./src/flowcontrol
- wails build -x darwin/amd64 --verbose
+ wails build -x darwin/amd64 --verbose -ldflags="-X 'main.appver=${{ github.ref }}'"
#Zip assets
- name: Zip assets
run: |
@@ -148,7 +148,7 @@ jobs:
if: ${{ !env.ACT }}
run: |
cd ./src/flowcontrol
- wails build -x linux/amd64 --verbose
+ wails build -x linux/amd64 --verbose -ldflags="-X 'main.appver=${{ github.ref }}'"
#Zip assets
- name: Zip assets
run: |
diff --git a/src/flowcontrol/frontend/src/App.vue b/src/flowcontrol/frontend/src/App.vue
index 48946cb..c2c7974 100644
--- a/src/flowcontrol/frontend/src/App.vue
+++ b/src/flowcontrol/frontend/src/App.vue
@@ -14,7 +14,9 @@
-
+
+
+
diff --git a/src/flowcontrol/frontend/src/pages/Settings.vue b/src/flowcontrol/frontend/src/pages/Settings.vue
index 85f3cd8..d5dc1c0 100644
--- a/src/flowcontrol/frontend/src/pages/Settings.vue
+++ b/src/flowcontrol/frontend/src/pages/Settings.vue
@@ -2,7 +2,7 @@
Flowcontrol
-
v0.1.2
+
{{ version }}
GitHub
@@ -14,6 +14,17 @@ export default {
name: "settings",
components: {
FanIcon
+ },
+ data() {
+ return {
+ version: " "
+ };
+ },
+ mounted: function() {
+ var self = this;
+ window.backend.version().then(result => {
+ self.version = result;
+ });
}
};
diff --git a/src/flowcontrol/go.mod b/src/flowcontrol/go.mod
index 8e2d92b..75be0ab 100644
--- a/src/flowcontrol/go.mod
+++ b/src/flowcontrol/go.mod
@@ -4,6 +4,6 @@ go 1.16
require (
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07
- github.com/wailsapp/wails v1.16.3
+ github.com/wailsapp/wails v1.16.4-pre3
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd
)
diff --git a/src/flowcontrol/go.sum b/src/flowcontrol/go.sum
index cf62f27..e146346 100644
--- a/src/flowcontrol/go.sum
+++ b/src/flowcontrol/go.sum
@@ -59,8 +59,8 @@ github.com/syossan27/tebata v0.0.0-20180602121909-b283fe4bc5ba h1:2DHfQOxcpWdGf5
github.com/syossan27/tebata v0.0.0-20180602121909-b283fe4bc5ba/go.mod h1:iLnlXG2Pakcii2CU0cbY07DRCSvpWNa7nFxtevhOChk=
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07 h1:UyzmZLoiDWMRywV4DUYb9Fbt8uiOSooupjTq10vpvnU=
github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA=
-github.com/wailsapp/wails v1.16.3 h1:wuJJU9PnnrrDvhh+DTr1MfqUSR1PDR5H+RilM5Wwd7c=
-github.com/wailsapp/wails v1.16.3/go.mod h1:aADbAvTzZrKGd4Td7d1l4Dp5Hx7lLJEvVH7guIHoDf8=
+github.com/wailsapp/wails v1.16.4-pre3 h1:ITalbeNsJ7dUACHcdczOzaDKVxZJBXUeUGEp3RoQieI=
+github.com/wailsapp/wails v1.16.4-pre3/go.mod h1:aADbAvTzZrKGd4Td7d1l4Dp5Hx7lLJEvVH7guIHoDf8=
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
diff --git a/src/flowcontrol/main.go b/src/flowcontrol/main.go
index acbec41..b4e3ca7 100644
--- a/src/flowcontrol/main.go
+++ b/src/flowcontrol/main.go
@@ -12,6 +12,8 @@ var js string
//go:embed frontend/dist/app.css
var css string
+var appver = "development"
+
func main() {
app := wails.CreateApp(&wails.AppConfig{
@@ -23,5 +25,10 @@ func main() {
Colour: "#131313",
})
app.Bind(&wailsstruct{})
+ app.Bind(version)
app.Run()
}
+
+func version() string{
+ return appver;
+}
\ No newline at end of file