mirror of
https://github.com/livebook-dev/livebook.git
synced 2024-09-20 01:55:56 +08:00
Extend configuration for update check to include version (#2780)
Co-authored-by: José Valim <jose.valim@gmail.com> Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
This commit is contained in:
parent
6573f0204e
commit
7ec3976b7a
|
@ -38,7 +38,7 @@ config :livebook,
|
|||
shutdown_callback: nil,
|
||||
teams_auth?: false,
|
||||
teams_url: "https://teams.livebook.dev",
|
||||
github_release_repo: "livebook-dev/livebook",
|
||||
github_release_info: %{repo: "livebook-dev/livebook", version: Mix.Project.config()[:version]},
|
||||
update_instructions_url: nil,
|
||||
within_iframe: false
|
||||
|
||||
|
|
|
@ -424,8 +424,9 @@ defmodule Livebook.Config do
|
|||
@doc """
|
||||
Returns the GitHub org/repo where the releases are created.
|
||||
"""
|
||||
def github_release_repo() do
|
||||
Application.get_env(:livebook, :github_release_repo)
|
||||
@spec github_release_info() :: %{repo: String.t(), version: String.t()}
|
||||
def github_release_info() do
|
||||
Application.get_env(:livebook, :github_release_info)
|
||||
end
|
||||
|
||||
@doc """
|
||||
|
|
|
@ -128,7 +128,8 @@ defmodule Livebook.UpdateCheck do
|
|||
end
|
||||
|
||||
defp fetch_latest_version() do
|
||||
url = "https://api.github.com/repos/#{Livebook.Config.github_release_repo()}/releases/latest"
|
||||
repo = Livebook.Config.github_release_info().repo
|
||||
url = "https://api.github.com/repos/#{repo}/releases/latest"
|
||||
headers = [{"accept", "application/vnd.github.v3+json"}]
|
||||
|
||||
case Livebook.Utils.HTTP.request(:get, url, headers: headers) do
|
||||
|
@ -146,7 +147,7 @@ defmodule Livebook.UpdateCheck do
|
|||
end
|
||||
|
||||
defp new_version(release) do
|
||||
current_version = Livebook.Config.app_version()
|
||||
current_version = Livebook.Config.github_release_info().version
|
||||
|
||||
with %{
|
||||
"tag_name" => "v" <> version,
|
||||
|
|
Loading…
Reference in a new issue