Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
try version build
Browse files Browse the repository at this point in the history
  • Loading branch information
genofire committed May 1, 2021
1 parent 94b3d11 commit ddbb44a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
- name: Generate Docs
run: /home/runner/go/bin/swag init --parseDependency --parseDepth 2 --parseInternal -g web/api/docs.go -o web/docs
- name: Build
run: go build -v
run: go build -ldflags "-X github.com/$GITHUB_REPOSITORY.VERSION=`git describe --tags`" -v
- name: Archive build artifacts
uses: actions/upload-artifact@v2
with:
Expand Down
17 changes: 17 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,34 @@ import (
"github.com/Kukoon/media-server/runtime"
"github.com/Kukoon/media-server/web"
_ "github.com/Kukoon/media-server/web/all"
webM "github.com/Kukoon/media-server/web/metrics"
)

const undefinedVersion = "developing"

var VERSION = undefinedVersion

type configData struct {
Database models.Database `toml:"database"`
Webserver web.Service `toml:"webserver"`
}

func main() {
webM.VERSION = VERSION

configPath := "config.toml"
showVersion := false

flag.StringVar(&configPath, "c", configPath, "path to configuration file")
flag.BoolVar(&showVersion, "version", showVersion, "show current version")

flag.Parse()

if showVersion {
log.WithField("version", VERSION).Info("Version")
return
}

config := &configData{}
if err := runtime.ReadTOML(configPath, config); err != nil {
log.Panicf("open config file: %s", err)
Expand Down

0 comments on commit ddbb44a

Please sign in to comment.