forked from letscontrolit/ESPEasy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
before_deploy
executable file
·107 lines (83 loc) · 2.38 KB
/
before_deploy
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#!/bin/bash
VERSION=$(git describe)
TMP_DIR=`mktemp -d`
if [ $? -eq 0 ]; then
# Make sure coreutils is installed.
# if not, these terrible things may happen:
# https://www.letscontrolit.com/forum/viewtopic.php?f=6&t=8542
echo "Created ${TMP_DIR}"
else
echo "Could not create tmp dir, mktemp -d failed"
exit 1
fi
TMP_DIST=`echo "${TMP_DIR}/ESPEasy_collect_dist"`
mkdir -p ${TMP_DIST}
if [ $? -eq 0 ]; then
echo "Created ${TMP_DIST}"
else
echo "Could not create tmp dir: ${TMP_DIST}"
exit 1
fi
CURPATH=`pwd`
BUILD_LOG=`echo "${TMP_DIST}/buildlog.txt"`
# PIO 3.x :
# BINARY_PATH=".pioenvs"
# PIO 4.0 and newer:
BINARY_PATH=".pio/build"
while getopts d: option
do
case "${option}"
in
d) VERSION=${OPTARG};;
esac
done
if [ ! -d ${TMP_DIST} ]; then
# Could not create temp dir, so exit
exit 1
fi
echo "### Creating zip archives"
#Naming convention:
# ESP_Easy_[github version]_[plugin set]_[chip type]_[flash memory].bin
if [ -d "build_output/reject" ]; then
zip -qq ${CURPATH}/ESPEasy_ELF_files_$VERSION.zip build_output/reject/*
fi
zip -qq ${CURPATH}/ESPEasy_ELF_files_$VERSION.zip build_output/debug/*
echo "### Created ESPEasy_ELF_files_$VERSION.zip"
mkdir -p ${TMP_DIST}
cp -r dist/* ${TMP_DIST}/
if [ -d "docs/build" ]; then
# Docs have been created
zip -r -qq ${CURPATH}/ESPEasy_docs_$VERSION.zip docs/build/*
echo "### Created ESPEasy_docs_$VERSION.zip"
fi
#create a source structure that is the same as the original ESPEasy project (and works with the howto on the wiki)
#rm -rf dist/Source 2>/dev/null
mkdir -p ${TMP_DIST}/source
cp -r lib ${TMP_DIST}/source/
cp -r src ${TMP_DIST}/source/
cp -r misc ${TMP_DIST}/source/
cp -r static ${TMP_DIST}/source/
cp -r tools ${TMP_DIST}/source/
cp platformio*.ini ${TMP_DIST}/source/
cp *.txt ${TMP_DIST}/source/
cp *.csv ${TMP_DIST}/source/
cp README* ${TMP_DIST}/source/
cp -r build_output/bin/* ${TMP_DIST}/bin
rm -f ${TMP_DIST}/bin/*ESP32*
cd ${TMP_DIST}
if [ "$(ls -A ${TMP_DIST}/bin/)" ]; then
echo
zip -qq ${CURPATH}/ESPEasy_ESP82xx_$VERSION.zip -r .
echo "### Created ESPEasy_ESP82xx_$VERSION.zip"
fi
cd ${CURPATH}
rm -f ${TMP_DIST}/bin/*
cp -r build_output/bin/*ESP32* ${TMP_DIST}/bin
cd ${TMP_DIST}
if [ "$(ls -A ${TMP_DIST}/bin/)" ]; then
echo
zip -qq ${CURPATH}/ESPEasy_ESP32_$VERSION.zip -r .
echo "### Created ESPEasy_ESP32_$VERSION.zip"
fi
rm -Rf ${TMP_DIST}/* 2>/dev/null
rmdir ${TMP_DIST}