-
Notifications
You must be signed in to change notification settings - Fork 29
/
release.sh
89 lines (68 loc) · 2.86 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/sh
init_env() {
current_dir=$(dirname "$(realpath "$0")")
export RELEASE_DIR=${current_dir};
cd "${RELEASE_DIR}" || exit
CURL_VERSION=$(head -n 1 release/version.txt)
export CURL_VERSION=${CURL_VERSION}
}
create_release_note() {
cd "${RELEASE_DIR}" || exit
local components protocols features output_sha256 markdown_table
echo "Creating release note..."
if [ "${TLS_LIB}" = "quictls" ]; then
components=$(head -n 1 release/version-info.txt | sed 's#OpenSSL/#quictls/#g' | sed 's/ /\n/g' | grep '/' | sed 's#^#- #g' || true)
else
components=$(head -n 1 release/version-info.txt | sed 's/ /\n/g' | grep '/' | sed 's#^#- #g' || true)
fi
protocols=$(grep Protocols release/version-info.txt | cut -d":" -f2 | sed -e 's/^[[:space:]]*//')
features=$(grep Features release/version-info.txt | cut -d":" -f2 | sed -e 's/^[[:space:]]*//')
echo "Creating checksum..."
output_sha256=$(sha256sum release/bin/curl-linux* release/bin/curl-macos* release/bin/curl-windows* \
| sed 's#release/bin/##g' | sed 's#-# #g' | sed 's#.exe##g')
markdown_table=$(printf "%s" "${output_sha256}" |
awk 'BEGIN {print "| File | Platform | Arch | LibC | SHA256 |\n|------|------|------|--------|--------|"}
{printf("| %s | %s | %s | %s | %s |\n", $2, $3, $4, $5, $1)}')
cat > release/release.md<<EOF
# Static cURL ${CURL_VERSION} with HTTP3
## Components
${components}
## Protocols
${protocols}
## Features
${features}
## License
This binary includes various open-source software such as curl, openssl, zlib, brotli, zstd, libidn2, libssh2, nghttp2, ngtcp2, nghttp3. Their license information has been compiled and is included in the dev package.
## Checksums
${markdown_table}
EOF
}
tar_curl() {
cd "${RELEASE_DIR}/release/bin" || exit
chmod +x curl-[lmw]* trurl-*;
for file in curl-linux-* curl-macos-*; do
mv "${file}" curl;
trurl_filename=$(echo "${file}" | sed 's#curl-#trurl-#g')
if [ -f "${trurl_filename}" ]; then
mv "${trurl_filename}" trurl;
XZ_OPT=-9 tar -Jcf "${file}-${CURL_VERSION}.tar.xz" curl trurl && rm -f curl trurl;
else
XZ_OPT=-9 tar -Jcf "${file}-${CURL_VERSION}.tar.xz" curl && rm -f curl
fi
done
for file in curl-*.exe; do
mv "${file}" curl.exe;
filename="${file%.exe}"
trurl_filename=$(echo "${file}" | sed 's#curl-#trurl-#g')
if [ -f "${trurl_filename}" ]; then
mv "${trurl_filename}" trurl.exe;
XZ_OPT=-9 tar -Jcf "${filename}-${CURL_VERSION}.tar.xz" curl.exe trurl.exe curl-ca-bundle.crt && rm -f curl.exe trurl.exe;
else
XZ_OPT=-9 tar -Jcf "${filename}-${CURL_VERSION}.tar.xz" curl.exe curl-ca-bundle.crt && rm -f curl.exe;
fi
done
rm -f curl-ca-bundle.crt;
}
init_env;
create_release_note;
tar_curl;