Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set version in github release and print it #57

Merged
merged 1 commit into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ jobs:
binary_name: can2mqtt
compress_assets: false
project_path: src
ldflags: -X "main.version=${{ vars.GITHUB_REF_NAME }}"
env:
CGO_ENABLED: 0
17 changes: 10 additions & 7 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@ import (
"sync"
)

var pairFromID map[uint32]*can2mqtt // c2m pair (lookup from ID)
var pairFromTopic map[string]*can2mqtt // c2m pair (lookup from Topic)
var debugLog bool
var canInterface, mqttConnection, configFile string
var dirMode = 0 // directional modes: 0=bidirectional 1=can2mqtt only 2=mqtt2can only [-d]
var wg sync.WaitGroup
var (
pairFromID map[uint32]*can2mqtt // c2m pair (lookup from ID)
pairFromTopic map[string]*can2mqtt // c2m pair (lookup from Topic)
debugLog bool
canInterface, mqttConnection, configFile string
version = "dev"
dirMode = 0 // directional modes: 0=bidirectional 1=can2mqtt only 2=mqtt2can only [-d]
wg sync.WaitGroup
)

func main() {
log.SetFlags(0)
Expand All @@ -38,7 +41,7 @@ func main() {
slog.SetLogLoggerLevel(slog.LevelDebug)
}

slog.Info("Starting can2mqtt", "mqtt-config", mqttConnection, "can-interface", canInterface, "can2mqtt.csv", configFile, "dir-mode", dirMode, "debug", debugLog)
slog.Info("Starting can2mqtt", "version", version, "mqtt-config", mqttConnection, "can-interface", canInterface, "can2mqtt.csv", configFile, "dir-mode", dirMode, "debug", debugLog)
wg.Add(1)
go canStart(canInterface) // epic parallel shit ;-)
mqttStart(mqttConnection)
Expand Down
Loading