fix parser version check
This commit is contained in:
parent
6cebd03d7f
commit
10159f7ba7
1 changed files with 14 additions and 16 deletions
|
|
@ -30,15 +30,6 @@ defmodule Aprsme.DependencyInfo do
|
||||||
_ -> nil
|
_ -> nil
|
||||||
end
|
end
|
||||||
|
|
||||||
defp fetch_aprs_sha_from_github do
|
|
||||||
resp = Req.get!("https://api.github.com/repos/aprsme/aprs/commits/main")
|
|
||||||
body = resp.body
|
|
||||||
sha = body["sha"] || body |> Jason.decode!() |> Access.get("sha")
|
|
||||||
String.slice(sha, 0, 7)
|
|
||||||
rescue
|
|
||||||
_ -> nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def latest_aprs_library_sha do
|
def latest_aprs_library_sha do
|
||||||
resp = Req.get!("https://api.github.com/repos/aprsme/aprs/commits/main")
|
resp = Req.get!("https://api.github.com/repos/aprsme/aprs/commits/main")
|
||||||
body = resp.body
|
body = resp.body
|
||||||
|
|
@ -62,14 +53,21 @@ defmodule Aprsme.DependencyInfo do
|
||||||
# Try to read from the file copied during build
|
# Try to read from the file copied during build
|
||||||
hash_file = Path.join(["/app", "parser_hash.txt"])
|
hash_file = Path.join(["/app", "parser_hash.txt"])
|
||||||
|
|
||||||
if File.exists?(hash_file) do
|
# Try alternative paths
|
||||||
case File.read(hash_file) do
|
alternative_paths = [
|
||||||
{:ok, hash} -> String.trim(hash)
|
hash_file,
|
||||||
_ -> "unknown"
|
Path.join([File.cwd!(), "parser_hash.txt"]),
|
||||||
|
"parser_hash.txt"
|
||||||
|
]
|
||||||
|
|
||||||
|
Enum.find_value(alternative_paths, "unknown", fn path ->
|
||||||
|
if File.exists?(path) do
|
||||||
|
case File.read(path) do
|
||||||
|
{:ok, hash} -> String.trim(hash)
|
||||||
|
_ -> nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
end)
|
||||||
"unknown"
|
|
||||||
end
|
|
||||||
|
|
||||||
hash ->
|
hash ->
|
||||||
hash
|
hash
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue