mirror of
https://github.com/teslamate-org/teslamate.git
synced 2026-01-24 21:06:08 +08:00
Read version from file
This commit is contained in:
@@ -25,6 +25,7 @@ COPY lib lib
|
||||
COPY priv/repo/migrations priv/repo/migrations
|
||||
COPY priv/gettext priv/gettext
|
||||
COPY grafana/dashboards grafana/dashboards
|
||||
COPY VERSION VERSION
|
||||
|
||||
RUN mkdir -p /opt/built && \
|
||||
mix "do" compile, release --path /opt/built
|
||||
|
||||
14
Makefile
14
Makefile
@@ -1,17 +1,19 @@
|
||||
.PHONY: help grafana teslamate
|
||||
.PHONY: help vsn grafana teslamate
|
||||
|
||||
APP_NAME ?= `grep 'app:' mix.exs | sed -e 's/\[//g' -e 's/ //g' -e 's/app://' -e 's/[:,]//g'`
|
||||
APP_VSN ?= `grep 'version:' mix.exs | cut -d '"' -f2`
|
||||
APP_VSN ?= `cat VERSION`
|
||||
BUILD ?= `git rev-parse --short HEAD`
|
||||
|
||||
help:
|
||||
@echo "$(APP_NAME):$(APP_VSN)-$(BUILD)"
|
||||
help: vsn
|
||||
@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
teslamate: ## Build teslamate Docker image
|
||||
vsn:
|
||||
@echo "$(APP_NAME):$(APP_VSN)-$(BUILD)"
|
||||
|
||||
teslamate: vsn ## Build teslamate Docker image
|
||||
@docker build --pull \
|
||||
-t $(APP_NAME):$(APP_VSN)-$(BUILD) \
|
||||
-t $(APP_NAME) .
|
||||
|
||||
grafana: ## Build teslamate-grafana Docker image
|
||||
grafana: vsn ## Build teslamate-grafana Docker image
|
||||
@cd grafana && docker build --pull -t teslamate-grafana .
|
||||
|
||||
9
mix.exs
9
mix.exs
@@ -4,7 +4,7 @@ defmodule TeslaMate.MixProject do
|
||||
def project do
|
||||
[
|
||||
app: :teslamate,
|
||||
version: "1.20.0",
|
||||
version: version(),
|
||||
elixir: "~> 1.10",
|
||||
elixirc_paths: elixirc_paths(Mix.env()),
|
||||
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
|
||||
@@ -81,4 +81,11 @@ defmodule TeslaMate.MixProject do
|
||||
]
|
||||
]
|
||||
end
|
||||
|
||||
defp version do
|
||||
case File.read("VERSION") do
|
||||
{:ok, version} -> String.trim(version)
|
||||
{:error, _reason} -> "0.0.0"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user