Skip to content

Commit

Permalink
works!!!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
craig-day committed Mar 27, 2020
1 parent 6add66c commit 12c297f
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git
.github
9 changes: 9 additions & 0 deletions src/core-release-filter.jq
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
.assets[]
| . as $release
| if (.name | test("dhall-[0-9.]+.*-linux.tar.bz2"; "i")) then
$release.browser_download_url
else
""
end
] | reduce .[] as $url (""; . + $url)
39 changes: 39 additions & 0 deletions src/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh
set -e

apk add --quiet --no-progress curl jq

echo "Installing dhall version: $1"

url_path=latest

if [ "$1" != "latest" ]
then
url_path="tags/$1"
fi

curl -s https://api.github.com/repos/dhall-lang/dhall-haskell/releases/$url_path > releases.json

core_download_url=$(jq --from-file src/core-release-filter.jq releases.json | tr -d '"')
json_download_url=$(jq --from-file src/json-release-filter.jq releases.json | tr -d '"')

# Cleanup to make sure the download can't fail
rm -f releases.json
rm -f dhall-*

echo "Downloading dhall from: $core_download_url"
wget --quiet $core_download_url

echo "Downloading dhall-json from: $json_download_url"
wget --quiet $json_download_url

# Extract dhall-json first, makes shell glob easier
tar --extract --bzip2 --file dhall-json-*-linux.tar.bz2
rm -f dhall-json-*-linux.tar.bz2

# Extract dhall now that dhall-json is done
tar --extract --bzip2 --file dhall-*-linux.tar.bz2
rm -f dhall-*-linux.tar.bz2

# Add the dhall executables to the path for future actions
echo "::add-path::$(pwd)/bin"
9 changes: 9 additions & 0 deletions src/json-release-filter.jq
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
.assets[]
| . as $release
| if (.name | test("dhall-json-[0-9.]+.*-linux.tar.bz2"; "i")) then
$release.browser_download_url
else
""
end
] | reduce .[] as $url (""; . + $url)

0 comments on commit 12c297f

Please sign in to comment.