-
Notifications
You must be signed in to change notification settings - Fork 13
/
package.sh.old
49 lines (31 loc) · 1.18 KB
/
package.sh.old
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
#!/bin/bash -e
#NODE_VERSION="$2"
NODE_VERSION=$(node -v | cut -d. -f1)
#RELEASE_VERSION="$1"
RELEASE_VERSION=$(grep '"version"' manifest.json | cut -d: -f2 | cut -d\" -f2)
BIT_TYPE=$(getconf LONG_BIT)
ARCHITECTURE='linux-armhf'
if [ $BIT_TYPE -eq 64 ]; then
ARCHITECTURE='linux-arm64'
fi
echo "Release version $RELEASE_VERSION"
echo "Node version: $NODE_VERSION"
echo "Architecture: $ARCHITECTURE"
rm -rf node_modules
npm install --production
shasum --algorithm 256 manifest.json package.json *.js LICENSE README.md > SHA256SUMS
find css images js node_modules views \( -type f -o -type l \) -exec shasum --algorithm 256 {} \; >> SHA256SUMS
TARFILE=`npm pack`
tar xzf ${TARFILE}
cp -r node_modules ./package
tar czf ${TARFILE} package
shasum --algorithm 256 ${TARFILE} > ${TARFILE}.sha256sum
rm -rf SHA256SUMS package
# It needs to become something like this: zigbee2mqtt-adapter-${{ env.RELEASE_VERSION }}-v${{ matrix.node-vers>
echo "renaming files"
echo "- old tar file: $TARFILE"
NEW_TARFILE="zigbee2mqtt-adapter-${RELEASE_VERSION}-${ARCHITECTURE}-${NODE_VERSION}.tgz"
echo "- new tar file: $NEW_TARFILE"
mv $TARFILE $NEW_TARFILE
mv $TARFILE.sha256sum $NEW_TARFILE.sha256sum
exit 0