mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-24 13:43:12 +02:00
Stamp edition and build number
This commit is contained in:
parent
2b42c73a22
commit
b22d34057e
1
.github/workflows/build-mac.yml
vendored
1
.github/workflows/build-mac.yml
vendored
@ -33,6 +33,7 @@ jobs:
|
||||
run: make mac-app
|
||||
env:
|
||||
DEVELOPER_DIR: /Applications/Xcode_12.3.app/Contents/Developer
|
||||
BUILD_NUMBER: ${{ github.run_id }}
|
||||
|
||||
- name: Upload macOS package
|
||||
uses: actions/upload-artifact@v1
|
||||
|
2
.github/workflows/build-ubuntu.yml
vendored
2
.github/workflows/build-ubuntu.yml
vendored
@ -33,6 +33,8 @@ jobs:
|
||||
|
||||
- name: Build Linux server and app
|
||||
run: make server-linux-package linux-app
|
||||
env:
|
||||
BUILD_NUMBER: ${{ github.run_id }}
|
||||
|
||||
- name: Upload server package
|
||||
uses: actions/upload-artifact@v1
|
||||
|
2
.github/workflows/build-win.yml
vendored
2
.github/workflows/build-win.yml
vendored
@ -30,6 +30,8 @@ jobs:
|
||||
|
||||
- name: Build Windows app
|
||||
run: make win-app
|
||||
env:
|
||||
BUILD_NUMBER: ${{ github.run_id }}
|
||||
|
||||
- name: Upload app package
|
||||
uses: actions/upload-artifact@v1
|
||||
|
37
Makefile
37
Makefile
@ -2,6 +2,19 @@
|
||||
|
||||
PACKAGE_FOLDER = octo
|
||||
|
||||
# Build Flags
|
||||
BUILD_NUMBER ?= $(BUILD_NUMBER:)
|
||||
BUILD_DATE = $(shell date -u)
|
||||
BUILD_HASH = $(shell git rev-parse HEAD)
|
||||
# If we don't set the build number it defaults to dev
|
||||
ifeq ($(BUILD_NUMBER),)
|
||||
BUILD_NUMBER := dev
|
||||
endif
|
||||
|
||||
LDFLAGS += -X "github.com/mattermost/mattermost-octo-tasks/server/model.BuildNumber=$(BUILD_NUMBER)"
|
||||
LDFLAGS += -X "github.com/mattermost/mattermost-octo-tasks/server/model.BuildDate=$(BUILD_DATE)"
|
||||
LDFLAGS += -X "github.com/mattermost/mattermost-octo-tasks/server/model.BuildHash=$(BUILD_HASH)"
|
||||
|
||||
all: server
|
||||
|
||||
prebuild:
|
||||
@ -13,18 +26,22 @@ prebuild:
|
||||
cd webapp; npm install
|
||||
|
||||
server:
|
||||
cd server; go build -o ../bin/octoserver ./main
|
||||
$(eval LDFLAGS += -X "github.com/mattermost/mattermost-octo-tasks/server/model.Edition=dev")
|
||||
cd server; go build -ldflags '$(LDFLAGS)' -o ../bin/octoserver ./main
|
||||
|
||||
server-mac:
|
||||
mkdir -p bin/mac
|
||||
cd server; env GOOS=darwin GOARCH=amd64 go build -o ../bin/mac/octoserver ./main
|
||||
$(eval LDFLAGS += -X "github.com/mattermost/mattermost-octo-tasks/server/model.Edition=mac")
|
||||
cd server; env GOOS=darwin GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -o ../bin/mac/octoserver ./main
|
||||
|
||||
server-linux:
|
||||
mkdir -p bin/linux
|
||||
cd server; env GOOS=linux GOARCH=amd64 go build -o ../bin/linux/octoserver ./main
|
||||
$(eval LDFLAGS += -X "github.com/mattermost/mattermost-octo-tasks/server/model.Edition=linux")
|
||||
cd server; env GOOS=linux GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -o ../bin/linux/octoserver ./main
|
||||
|
||||
server-win:
|
||||
cd server; env GOOS=windows GOARCH=amd64 go build -o ../bin/win/octoserver.exe ./main
|
||||
$(eval LDFLAGS += -X "github.com/mattermost/mattermost-octo-tasks/server/model.Edition=win")
|
||||
cd server; env GOOS=windows GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -o ../bin/win/octoserver.exe ./main
|
||||
|
||||
server-linux-package: server-linux webapp
|
||||
rm -rf package
|
||||
@ -37,18 +54,22 @@ server-linux-package: server-linux webapp
|
||||
rm -rf package
|
||||
|
||||
server-single-user:
|
||||
cd server; go build -o ../bin/octoserver ./main --single-user
|
||||
$(eval LDFLAGS += -X "github.com/mattermost/mattermost-octo-tasks/server/model.Edition=dev")
|
||||
cd server; go build -ldflags '$(LDFLAGS)' -o ../bin/octoserver ./main --single-user
|
||||
|
||||
server-mac-single-user:
|
||||
mkdir -p bin/mac
|
||||
cd server; env GOOS=darwin GOARCH=amd64 go build -o ../bin/mac/octoserver ./main --single-user
|
||||
$(eval LDFLAGS += -X "github.com/mattermost/mattermost-octo-tasks/server/model.Edition=mac")
|
||||
cd server; env GOOS=darwin GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -o ../bin/mac/octoserver ./main --single-user
|
||||
|
||||
server-linux-single-user:
|
||||
mkdir -p bin/linux
|
||||
cd server; env GOOS=linux GOARCH=amd64 go build -o ../bin/linux/octoserver ./main --single-user
|
||||
$(eval LDFLAGS += -X "github.com/mattermost/mattermost-octo-tasks/server/model.Edition=linux")
|
||||
cd server; env GOOS=linux GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -o ../bin/linux/octoserver ./main --single-user
|
||||
|
||||
server-win-single-user:
|
||||
cd server; env GOOS=windows GOARCH=amd64 go build -o ../bin/octoserver.exe ./main --single-user
|
||||
$(eval LDFLAGS += -X "github.com/mattermost/mattermost-octo-tasks/server/model.Edition=win")
|
||||
cd server; env GOOS=windows GOARCH=amd64 go build -ldflags '$(LDFLAGS)' -o ../bin/octoserver.exe ./main --single-user
|
||||
|
||||
generate:
|
||||
cd server; go get -modfile=go.tools.mod github.com/golang/mock/mockgen
|
||||
|
@ -7,6 +7,7 @@ import (
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
"github.com/mattermost/mattermost-octo-tasks/server/model"
|
||||
"github.com/mattermost/mattermost-octo-tasks/server/server"
|
||||
"github.com/mattermost/mattermost-octo-tasks/server/services/config"
|
||||
)
|
||||
@ -45,11 +46,17 @@ func monitorPid(pid int) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
// Log version
|
||||
log.Println("Version: " + model.CurrentVersion)
|
||||
log.Println("Edition: " + model.Edition)
|
||||
log.Println("Build Number: " + model.BuildNumber)
|
||||
log.Println("Build Date: " + model.BuildDate)
|
||||
log.Println("Build Hash: " + model.BuildHash)
|
||||
|
||||
// config.json file
|
||||
config, err := config.ReadConfigFile()
|
||||
if err != nil {
|
||||
log.Fatal("Unable to read the config file: ", err)
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
14
server/model/version.go
Normal file
14
server/model/version.go
Normal file
@ -0,0 +1,14 @@
|
||||
package model
|
||||
|
||||
// This is a list of all the current versions including any patches.
|
||||
// It should be maintained in chronological order with most current
|
||||
// release at the front of the list.
|
||||
var versions = []string{
|
||||
"0.1.0",
|
||||
}
|
||||
|
||||
var CurrentVersion string = versions[0]
|
||||
var BuildNumber string
|
||||
var BuildDate string
|
||||
var BuildHash string
|
||||
var Edition string
|
@ -14,6 +14,7 @@ import (
|
||||
|
||||
"github.com/mattermost/mattermost-octo-tasks/server/api"
|
||||
"github.com/mattermost/mattermost-octo-tasks/server/app"
|
||||
appModel "github.com/mattermost/mattermost-octo-tasks/server/model"
|
||||
"github.com/mattermost/mattermost-octo-tasks/server/services/config"
|
||||
"github.com/mattermost/mattermost-octo-tasks/server/services/scheduler"
|
||||
"github.com/mattermost/mattermost-octo-tasks/server/services/store"
|
||||
@ -27,8 +28,6 @@ import (
|
||||
"github.com/mattermost/mattermost-server/v5/services/filesstore"
|
||||
)
|
||||
|
||||
const currentVersion = "0.0.1"
|
||||
|
||||
type Server struct {
|
||||
config *config.Configuration
|
||||
wsServer *ws.Server
|
||||
@ -109,7 +108,10 @@ func New(cfg *config.Configuration, singleUser bool) (*Server, error) {
|
||||
telemetryService := telemetry.New(telemetryID, zap.NewStdLog(logger))
|
||||
telemetryService.RegisterTracker("server", func() map[string]interface{} {
|
||||
return map[string]interface{}{
|
||||
"version": currentVersion,
|
||||
"version": appModel.CurrentVersion,
|
||||
"build_number": appModel.BuildNumber,
|
||||
"build_hash": appModel.BuildHash,
|
||||
"edition": appModel.Edition,
|
||||
"operating_system": runtime.GOOS,
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user