-
Notifications
You must be signed in to change notification settings - Fork 26
/
build.sh
executable file
·76 lines (55 loc) · 1.65 KB
/
build.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
#!/bin/bash
#############################################
# Apio examples package builder #
#############################################
# Usage:
# ./build.sh
# -- Set the version the generated package
VERSION=0.1.2
# For debugging, echo executed commands.
# set -x
# Exit on any error
set -e
# Set english language for propper pattern matching
export LC_ALL=C
# Sanity check
if find . | grep -e _build -e .sconsign.dblite
then
echo
echo "Error: the examples directory seems to contain build artifacts."
echo "Try running ./clean_examples.sh"
exit 1
fi
# -- Store the current dir
WORK_DIR=$PWD
# -- This version is stored in a temporal file so that github actions
# -- can read it and figure out the package name for upload it to
# -- the new release
echo "$VERSION" > "VERSION_BUILD"
# -- Show the packaged version
echo "Package version: ${VERSION}"
# -- Construct the package name.
PACKAGE_NAME="apio-examples-${VERSION}"
# -- Show the package name
echo "Package name: ${PACKAGE_NAME}"
# -- Make an empty package dir.
rm -rf "_package"
mkdir -p "_package"
# -- Copy the examples direcory to package dir but name with the
# -- package name.
cp -r ./examples _package/${PACKAGE_NAME}
# -- Copy the license file.
cp LICENSE _package/${PACKAGE_NAME}
# -- Copy the build version as VERSION file.
cp VERSION_BUILD _package/${PACKAGE_NAME}/VERSION
# -- Go to the package dir.
cd _package
# -- Zip the dir with the examples copies.
zip -r "${PACKAGE_NAME}.zip" "${PACKAGE_NAME}"
# -- Return to the original directory (repo top).
cd ${WORK_DIR}
# -- All done.
echo
echo "Generated package file"
ls -al "_package/${PACKAGE_NAME}.zip"
echo "All done OK."