1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

feat: automatic version.txt updates

Resolves #387
This commit is contained in:
Steven Tang 2022-07-09 13:58:16 +10:00
parent d5a85639b1
commit 20993a1182
No known key found for this signature in database
GPG Key ID: C7B961512342C50E
6 changed files with 29 additions and 5 deletions

View File

@ -11,6 +11,15 @@ jobs:
name: 'Build and publish Docker image'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set version
run: |
(git describe --tags --exact-match \
|| git symbolic-ref -q --short HEAD \
|| git rev-parse --short HEAD) > version.txt 2> /dev/null
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
@ -47,6 +56,7 @@ jobs:
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7

View File

@ -33,6 +33,13 @@ jobs:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Set version
shell: bash
run: |
(git describe --tags --exact-match \
|| git symbolic-ref -q --short HEAD \
|| git rev-parse --short HEAD) > version.txt 2> /dev/null
- name: Get dependencies
run: go get

View File

@ -4,10 +4,10 @@ import (
"encoding/json"
"flag"
"fmt"
uuid "github.com/satori/go.uuid"
"io/ioutil"
"net/http"
"os"
"regexp"
"strings"
"time"
@ -16,6 +16,7 @@ import (
"github.com/jinzhu/configor"
"github.com/muety/wakapi/data"
"github.com/muety/wakapi/models"
uuid "github.com/satori/go.uuid"
"gorm.io/gorm"
)
@ -363,7 +364,13 @@ func Load(version string) *Config {
}
env = config.Env
config.Version = strings.TrimSpace(version)
tagVersionMatch, _ := regexp.MatchString(`\d+\.\d+\.\d+`, version)
if tagVersionMatch {
config.Version = "v" + config.Version
}
config.InstanceId = uuid.NewV4().String()
config.App.Colors = readColors()
config.Db.Dialect = resolveDbDialect(config.Db.Type)

View File

@ -2,15 +2,15 @@ package routes
import (
"fmt"
"github.com/duke-git/lancet/v2/datetime"
"github.com/muety/wakapi/views"
"html/template"
"net/http"
"strings"
"github.com/duke-git/lancet/v2/datetime"
"github.com/muety/wakapi/config"
"github.com/muety/wakapi/models"
"github.com/muety/wakapi/utils"
"github.com/muety/wakapi/views"
)
type action func(w http.ResponseWriter, r *http.Request) (int, string, string)

View File

@ -1 +1 @@
2.3.5
dev

View File

@ -1,6 +1,6 @@
<footer class="flex justify-between w-full text-center text-gray-500 text-xs mt-20">
<div class="text-xs font-mono font-semibold">
v{{ getVersion }} @ {{ getDbType }}
{{ getVersion }} @ {{ getDbType }}
</div>
<div class="font-semibold text-sm hidden sm:inline-block">
Made with &nbsp; <span class="iconify inline" data-icon="bi:heart-fill"></span> &nbsp; by <a href="https://muetsch.io" class="text-gray-400 hover:text-gray-300">Ferdinand Mütsch</a> as <a