-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpackage.sh
executable file
·46 lines (41 loc) · 1.29 KB
/
package.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
#!/usr/bin/env zsh
# Copyright (c) 2020-2024 AlertAvert.com. All rights reserved.
#
# Licensed under the Apache License, Version 2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Author: Marco Massenzio ([email protected])
set -eu
source scripts/utils.sh
declare -r TARBALL=${1:-}
if [[ -z ${TARBALL} ]]
then
echo "Usage: $(basename $0) TARBALL"
fatal "Destination TARBALL filename MUST be defined"
exit 1
fi
declare -r DEST=$(mktemp -d)
declare -r BASE=$(abspath $(dirname $0))
declare -r MISC=(parse-args/parse_args.py scripts/utils.sh images templates)
pushd ${BASE}
for f in $(ls scripts/) ; do
# utils.sh is sourced by other scripts, so it should
# retain its .sh extension and will not be made executable.
[[ ${f} == 'utils.sh' ]] && continue
# Removes the .sh extension
cp scripts/${f} ${DEST}/${f:r}
chmod +x $DEST/${f:r}
done
for f in ${MISC[@]} ; do
cp -r ${f} ${DEST}/
done
# Generate HTML instructions.
version=$(make version)
echo "<br/>
<img src=\"https://img.shields.io/badge/Version-${version}-red\" alt=\"Version ${version}\">
<br/>" > /tmp/version.html
pandoc README.md -t html -o /tmp/README.html
cat head.html /tmp/version.html /tmp/README.html tail.html >${DEST}/README.html
popd
tar cf ${TARBALL} -C ${DEST} .
success "Release tarball in ${TARBALL}"