Skip to content

Commit 12c297f

Browse files
committed
works!!!!!
1 parent 6add66c commit 12c297f

File tree

4 files changed

+59
-0
lines changed

4 files changed

+59
-0
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git
2+
.github

src/core-release-filter.jq

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[
2+
.assets[]
3+
| . as $release
4+
| if (.name | test("dhall-[0-9.]+.*-linux.tar.bz2"; "i")) then
5+
$release.browser_download_url
6+
else
7+
""
8+
end
9+
] | reduce .[] as $url (""; . + $url)

src/entrypoint.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/sh
2+
set -e
3+
4+
apk add --quiet --no-progress curl jq
5+
6+
echo "Installing dhall version: $1"
7+
8+
url_path=latest
9+
10+
if [ "$1" != "latest" ]
11+
then
12+
url_path="tags/$1"
13+
fi
14+
15+
curl -s https://api.github.com/repos/dhall-lang/dhall-haskell/releases/$url_path > releases.json
16+
17+
core_download_url=$(jq --from-file src/core-release-filter.jq releases.json | tr -d '"')
18+
json_download_url=$(jq --from-file src/json-release-filter.jq releases.json | tr -d '"')
19+
20+
# Cleanup to make sure the download can't fail
21+
rm -f releases.json
22+
rm -f dhall-*
23+
24+
echo "Downloading dhall from: $core_download_url"
25+
wget --quiet $core_download_url
26+
27+
echo "Downloading dhall-json from: $json_download_url"
28+
wget --quiet $json_download_url
29+
30+
# Extract dhall-json first, makes shell glob easier
31+
tar --extract --bzip2 --file dhall-json-*-linux.tar.bz2
32+
rm -f dhall-json-*-linux.tar.bz2
33+
34+
# Extract dhall now that dhall-json is done
35+
tar --extract --bzip2 --file dhall-*-linux.tar.bz2
36+
rm -f dhall-*-linux.tar.bz2
37+
38+
# Add the dhall executables to the path for future actions
39+
echo "::add-path::$(pwd)/bin"

src/json-release-filter.jq

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[
2+
.assets[]
3+
| . as $release
4+
| if (.name | test("dhall-json-[0-9.]+.*-linux.tar.bz2"; "i")) then
5+
$release.browser_download_url
6+
else
7+
""
8+
end
9+
] | reduce .[] as $url (""; . + $url)

0 commit comments

Comments
 (0)