This repository was archived by the owner on Jul 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.sh
executable file
·75 lines (56 loc) · 1.61 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
set -e -u
function join { local IFS="$1"; shift; echo "$*"; }
# $1 = hex version
# $2 = erlang version
# $3 = elixir version
# $4 = saved elixir version
function build {
rm .tool-versions || true
rm -rf _build || true
echo "erlang ${2}\nelixir ${3}" > .tool-versions
MIX_ENV=prod mix compile
MIX_ENV=prod mix archive.build
MIX_ENV=prod mix archive.build -o hex.ez
mv hex.ez hex-${4}.ez
mv hex-${1}.ez hex-${1}-${4}.ez
}
# $1 = hex version
# $... = elixir version
function hex_csv {
rm hex-1.x.csv || true
for elixir in ${@:2}
do
sha=$(shasum -a 512 hex-${1}-${elixir}.ez)
sha=($sha)
echo "${1},${sha},${elixir}" >> hex-1.x.csv
done
openssl dgst -sha512 -sign "${ELIXIR_PEM}" hex-1.x.csv | openssl base64 > hex-1.x.csv.signed
}
# $1 = source
# $2 = target
function s3cp {
aws s3 cp ${1} s3://s3.hex.pm/installs/${2} --acl public-read --cache-control "public, max-age=604800" --metadata "surrogate-key=installs"
}
# $1 = hex version
# $... = elixir versions
function upload {
for elixir in ${@:2}
do
s3cp hex-${elixir}.ez ${elixir}/hex.ez
s3cp hex-${1}-${elixir}.ez ${elixir}/hex-${1}.ez
done
# special case 1.0.0 upload
s3cp hex-1.0.0.ez hex.ez
s3cp hex-1.x.csv hex-1.x.csv
s3cp hex-1.x.csv.signed hex-1.x.csv.signed
}
# UPDATE THIS FOR EVERY RELEASE
hex_version=$1
build ${hex_version} 18.3.4.2 1.3.2 1.3.0
build ${hex_version} 18.3.4.2 1.2.6 1.2.0
build ${hex_version} 17.5.6.9 1.1.1 1.1.0
build ${hex_version} 17.5.6.9 1.0.5 1.0.0
hex_csv ${hex_version} 1.0.0 1.1.0 1.2.0 1.3.0
upload ${hex_version} 1.0.0 1.1.0 1.2.0 1.3.0
rm -rf _build
rm -rf .tool-versions