mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-01-28 02:18:50 +00:00
Merge pull request #342 from firezone/fix-version-in-production
Add git_sha script
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -130,6 +130,8 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Build
|
||||
env:
|
||||
GIT_SHA: ${{ github.sha }}
|
||||
run: |
|
||||
. $HOME/.asdf/asdf.sh
|
||||
cd omnibus
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
defmodule FzCommon.MixProject do
|
||||
use Mix.Project
|
||||
|
||||
@version_path "../../version.exs"
|
||||
@version_path "../../scripts/version.exs"
|
||||
|
||||
def version do
|
||||
Code.eval_file(@version_path)
|
||||
@@ -16,7 +16,7 @@ defmodule FzCommon.MixProject do
|
||||
config_path: "../../config/config.exs",
|
||||
deps_path: "../../deps",
|
||||
lockfile: "../../mix.lock",
|
||||
elixir: "~> 1.11",
|
||||
elixir: "~> 1.12",
|
||||
start_permanent: Mix.env() == :prod,
|
||||
deps: deps()
|
||||
]
|
||||
|
||||
@@ -142,7 +142,7 @@
|
||||
</div>
|
||||
<div class="level-right">
|
||||
<div class="level-item">
|
||||
<a href={"https://github.com/firezone/firezone/tree/#{github_sha()}"}>
|
||||
<a href={"https://github.com/firezone/firezone/tree/#{git_sha()}"}>
|
||||
Version <%= application_version() %>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -23,8 +23,8 @@ defmodule FzHttpWeb.LayoutView do
|
||||
The current github sha, used to link to our Github repo.
|
||||
This is set during application compile time.
|
||||
"""
|
||||
def github_sha do
|
||||
Application.get_env(:fz_http, :github_sha, "master")
|
||||
def git_sha do
|
||||
Application.fetch_env!(:fz_http, :git_sha)
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
defmodule FzHttp.MixProject do
|
||||
use Mix.Project
|
||||
|
||||
@version_path "../../version.exs"
|
||||
@version_path "../../scripts/version.exs"
|
||||
|
||||
def version do
|
||||
Code.eval_file(@version_path)
|
||||
@@ -16,7 +16,7 @@ defmodule FzHttp.MixProject do
|
||||
config_path: "../../config/config.exs",
|
||||
deps_path: "../../deps",
|
||||
lockfile: "../../mix.lock",
|
||||
elixir: "~> 1.11",
|
||||
elixir: "~> 1.12",
|
||||
elixirc_paths: elixirc_paths(Mix.env()),
|
||||
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
|
||||
start_permanent: Mix.env() == :prod,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
defmodule FzVpn.MixProject do
|
||||
use Mix.Project
|
||||
|
||||
@version_path "../../version.exs"
|
||||
@version_path "../../scripts/version.exs"
|
||||
|
||||
def version do
|
||||
Code.eval_file(@version_path)
|
||||
@@ -16,7 +16,7 @@ defmodule FzVpn.MixProject do
|
||||
config_path: "../../config/config.exs",
|
||||
deps_path: "../../deps",
|
||||
lockfile: "../../mix.lock",
|
||||
elixir: "~> 1.11",
|
||||
elixir: "~> 1.12",
|
||||
start_permanent: Mix.env() == :prod,
|
||||
test_coverage: [tool: ExCoveralls],
|
||||
preferred_cli_env: [
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
defmodule FzWall.MixProject do
|
||||
use Mix.Project
|
||||
|
||||
@version_path "../../version.exs"
|
||||
@version_path "../../scripts/version.exs"
|
||||
|
||||
def version do
|
||||
Code.eval_file(@version_path)
|
||||
@@ -16,7 +16,7 @@ defmodule FzWall.MixProject do
|
||||
config_path: "../../config/config.exs",
|
||||
deps_path: "../../deps",
|
||||
lockfile: "../../mix.lock",
|
||||
elixir: "~> 1.11",
|
||||
elixir: "~> 1.12",
|
||||
start_permanent: Mix.env() == :prod,
|
||||
test_coverage: [tool: ExCoveralls],
|
||||
preferred_cli_env: [
|
||||
|
||||
@@ -26,13 +26,14 @@ require Logger
|
||||
# Use Jason for JSON parsing in Phoenix
|
||||
config :phoenix, :json_library, Jason
|
||||
|
||||
github_sha =
|
||||
case System.cmd("git", ["rev-parse", "--short", "HEAD"], stderr_to_stdout: true) do
|
||||
{result, 0} ->
|
||||
result |> String.trim()
|
||||
git_sha =
|
||||
case System.get_env("GIT_SHA") do
|
||||
nil ->
|
||||
{output, 0} = System.cmd("git", ["rev-parse", "--short", "HEAD"], stderr_to_stdout: true)
|
||||
String.trim(output)
|
||||
|
||||
{_, _} ->
|
||||
nil
|
||||
str ->
|
||||
str
|
||||
end
|
||||
|
||||
config :fz_http,
|
||||
@@ -41,7 +42,7 @@ config :fz_http,
|
||||
connectivity_checks_enabled: true,
|
||||
connectivity_checks_interval: 3_600,
|
||||
connectivity_checks_url: "https://ping-dev.firez.one/",
|
||||
github_sha: github_sha,
|
||||
git_sha: git_sha,
|
||||
cookie_signing_salt: "Z9eq8iof",
|
||||
ecto_repos: [FzHttp.Repo],
|
||||
admin_email: "firezone@localhost",
|
||||
|
||||
2
mix.exs
2
mix.exs
@@ -5,7 +5,7 @@ defmodule FirezoneUmbrella.MixProject do
|
||||
|
||||
use Mix.Project
|
||||
|
||||
@version_path "version.exs"
|
||||
@version_path "scripts/version.exs"
|
||||
|
||||
def version do
|
||||
Code.eval_file(@version_path)
|
||||
|
||||
2
scripts/version.exs
Normal file
2
scripts/version.exs
Normal file
@@ -0,0 +1,2 @@
|
||||
{result, 0} = System.cmd(Path.join([__DIR__, "semver.sh"]), [], stderr_to_stdout: true)
|
||||
result |> String.trim()
|
||||
@@ -1,7 +0,0 @@
|
||||
case System.cmd(Path.join([__DIR__, "scripts", "semver.sh"]), []) do
|
||||
{result, 0} ->
|
||||
result |> String.trim()
|
||||
|
||||
{_, _} ->
|
||||
"0.0.0"
|
||||
end
|
||||
Reference in New Issue
Block a user