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

chore: use git tag version instead #1798

Merged
merged 4 commits into from
Dec 11, 2020
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
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,14 @@ docker-watcher_info-prod:

docker-watcher-build:
docker build -f Dockerfile.watcher \
--build-arg release_version=$$(cat $(PWD)/VERSION)+$$(git rev-parse --short=7 HEAD) \
--build-arg release_version=$$(git describe --tags) \
--cache-from $(WATCHER_IMAGE_NAME) \
-t $(WATCHER_IMAGE_NAME) \
.

docker-watcher_info-build:
docker build -f Dockerfile.watcher_info \
--build-arg release_version=$$(cat $(PWD)/VERSION)+$$(git rev-parse --short=7 HEAD) \
--build-arg release_version=$$(git describe --tags) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--cache-from $(WATCHER_INFO_IMAGE_NAME) \
-t $(WATCHER_INFO_IMAGE_NAME) \
.
Expand Down
1 change: 0 additions & 1 deletion VERSION

This file was deleted.

10 changes: 9 additions & 1 deletion apps/omg/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule OMG.MixProject do
def project() do
[
app: :omg,
version: "#{String.trim(File.read!("../../VERSION"))}",
version: version(),
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand All @@ -24,6 +24,14 @@ defmodule OMG.MixProject do
]
end

defp version() do
"git"
|> System.cmd(["describe", "--tags", "--abbrev=0"])
|> elem(0)
|> String.replace("v", "")
|> String.replace("\n", "")
end

# Specifies which paths to compile per environment.
# :dev compiles `test/support` to gain access to various `Support.*` helpers
defp elixirc_paths(:prod), do: ["lib"]
Expand Down
10 changes: 9 additions & 1 deletion apps/omg_bus/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule OMG.Bus.MixProject do
def project() do
[
app: :omg_bus,
version: "#{String.trim(File.read!("../../VERSION"))}",
version: version(),
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand All @@ -25,6 +25,14 @@ defmodule OMG.Bus.MixProject do
]
end

defp version() do
"git"
|> System.cmd(["describe", "--tags", "--abbrev=0"])
|> elem(0)
|> String.replace("v", "")
|> String.replace("\n", "")
end

# Specifies which paths to compile per environment.
defp elixirc_paths(:prod), do: ["lib"]
defp elixirc_paths(:dev), do: ["lib"]
Expand Down
10 changes: 9 additions & 1 deletion apps/omg_conformance/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule OMG.Conformance.MixProject do
def project() do
[
app: :omg_conformance,
version: "#{String.trim(File.read!("../../VERSION"))}",
version: version(),
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand All @@ -23,6 +23,14 @@ defmodule OMG.Conformance.MixProject do
]
end

defp version() do
"git"
|> System.cmd(["describe", "--tags", "--abbrev=0"])
|> elem(0)
|> String.replace("v", "")
|> String.replace("\n", "")
end

defp elixirc_paths(:prod), do: ["lib"]
defp elixirc_paths(:dev), do: ["lib"]
defp elixirc_paths(:test), do: ["lib", "test/support"]
Expand Down
10 changes: 9 additions & 1 deletion apps/omg_db/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule OMG.DB.MixProject do
def project() do
[
app: :omg_db,
version: "#{String.trim(File.read!("../../VERSION"))}",
version: version(),
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand All @@ -25,6 +25,14 @@ defmodule OMG.DB.MixProject do
]
end

defp version() do
"git"
|> System.cmd(["describe", "--tags", "--abbrev=0"])
|> elem(0)
|> String.replace("v", "")
|> String.replace("\n", "")
end

# Specifies which paths to compile per environment.
defp elixirc_paths(:prod), do: ["lib"]
defp elixirc_paths(:dev), do: ["lib"]
Expand Down
10 changes: 9 additions & 1 deletion apps/omg_eth/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ defmodule OMG.Eth.MixProject do
def project() do
[
app: :omg_eth,
version: "#{String.trim(File.read!("../../VERSION"))}",
version: version(),
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand All @@ -27,6 +27,14 @@ defmodule OMG.Eth.MixProject do
]
end

defp version() do
"git"
|> System.cmd(["describe", "--tags", "--abbrev=0"])
|> elem(0)
|> String.replace("v", "")
|> String.replace("\n", "")
end

# Specifies which paths to compile per environment.
# :dev compiles `test/support` to gain access to various `Support.*` helpers
defp elixirc_paths(:prod), do: ["lib"]
Expand Down
10 changes: 9 additions & 1 deletion apps/omg_status/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule OMG.Status.Mixfile do
def project() do
[
app: :omg_status,
version: "#{String.trim(File.read!("../../VERSION"))}",
version: version(),
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand All @@ -31,6 +31,14 @@ defmodule OMG.Status.Mixfile do
]
end

defp version() do
"git"
|> System.cmd(["describe", "--tags", "--abbrev=0"])
|> elem(0)
|> String.replace("v", "")
|> String.replace("\n", "")
end

defp deps(),
do: [
{:telemetry, "~> 0.4.1"},
Expand Down
10 changes: 9 additions & 1 deletion apps/omg_utils/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Utils.MixProject do
def project() do
[
app: :omg_utils,
version: "#{String.trim(File.read!("../../VERSION"))}",
version: version(),
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand All @@ -21,6 +21,14 @@ defmodule Utils.MixProject do
[extra_applications: [:plug]]
end

defp version() do
"git"
|> System.cmd(["describe", "--tags", "--abbrev=0"])
|> elem(0)
|> String.replace("v", "")
|> String.replace("\n", "")
end

# Specifies which paths to compile per environment.
defp elixirc_paths(:prod), do: ["lib"]
defp elixirc_paths(:dev), do: ["lib"]
Expand Down
10 changes: 9 additions & 1 deletion apps/omg_watcher/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule OMG.Watcher.MixProject do
def project() do
[
app: :omg_watcher,
version: "#{String.trim(File.read!("../../VERSION"))}",
version: version(),
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand All @@ -26,6 +26,14 @@ defmodule OMG.Watcher.MixProject do
]
end

defp version() do
"git"
|> System.cmd(["describe", "--tags", "--abbrev=0"])
|> elem(0)
|> String.replace("v", "")
|> String.replace("\n", "")
end

# Specifies which paths to compile per environment.
defp elixirc_paths(:prod), do: ["lib"]
defp elixirc_paths(:dev), do: ["lib"]
Expand Down
10 changes: 9 additions & 1 deletion apps/omg_watcher_info/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule OMG.WatcherInfo.MixProject do
def project() do
[
app: :omg_watcher_info,
version: "#{String.trim(File.read!("../../VERSION"))}",
version: version(),
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand All @@ -26,6 +26,14 @@ defmodule OMG.WatcherInfo.MixProject do
]
end

defp version() do
"git"
|> System.cmd(["describe", "--tags", "--abbrev=0"])
|> elem(0)
|> String.replace("v", "")
|> String.replace("\n", "")
end

# Specifies which paths to compile per environment.
defp elixirc_paths(:prod), do: ["lib"]
defp elixirc_paths(:dev), do: ["lib"]
Expand Down
17 changes: 16 additions & 1 deletion apps/omg_watcher_rpc/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,16 @@ defmodule OMG.WatcherRPC.Mixfile do
use Mix.Project

def project() do
version =
"git"
|> System.cmd(["describe", "--tags", "--abbrev=0"])
|> elem(0)
|> String.replace("v", "")
|> String.replace("\n", "")

[
app: :omg_watcher_rpc,
version: "#{String.trim(File.read!("../../VERSION"))}",
version: version(),
build_path: "../../_build",
config_path: "../../config/config.exs",
deps_path: "../../deps",
Expand All @@ -25,6 +32,14 @@ defmodule OMG.WatcherRPC.Mixfile do
]
end

defp version() do
"git"
|> System.cmd(["describe", "--tags", "--abbrev=0"])
|> elem(0)
|> String.replace("v", "")
|> String.replace("\n", "")
end

# Specifies which paths to compile per environment.
defp elixirc_paths(:prod), do: ["lib"]
defp elixirc_paths(:dev), do: ["lib"]
Expand Down
10 changes: 9 additions & 1 deletion apps/xomg_tasks/mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ defmodule OMG.XomgTasks.MixProject do
def project() do
[
app: :xomg_tasks,
version: "#{String.trim(File.read!("../../VERSION"))}",
version: version(),
build_path: "../../_build",
deps_path: "../../deps",
lockfile: "../../mix.lock",
Expand All @@ -23,4 +23,12 @@ defmodule OMG.XomgTasks.MixProject do
def application() do
[extra_applications: [:iex, :logger]]
end

defp version() do
"git"
|> System.cmd(["describe", "--tags", "--abbrev=0"])
|> elem(0)
|> String.replace("v", "")
|> String.replace("\n", "")
end
end
6 changes: 4 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,10 @@ defmodule OMG.Umbrella.MixProject do
defp docker(), do: if(System.get_env("DOCKER"), do: "_docker", else: "")

defp current_version() do
sha = String.replace(elem(System.cmd("git", ["rev-parse", "--short=7", "HEAD"]), 0), "\n", "")
"#{String.trim(File.read!("VERSION"))}" <> "+" <> sha
"git"
|> System.cmd(["describe", "--tags"])
|> elem(0)
|> String.replace("\n", "")
end

defp steps() do
Expand Down