-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·57 lines (46 loc) · 1.73 KB
/
release.sh
File metadata and controls
executable file
·57 lines (46 loc) · 1.73 KB
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
#!/bin/bash
set -e
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
if ! command -v gh &> /dev/null
then
echo "'gh' could not be found"
exit
fi
if ! command -v cargo &> /dev/null
then
echo "'cargo' could not be found"
exit
fi
cd $SCRIPT_DIR
LAST_FIRMWARE_VERSION=$(gh release list | head -n 1 | cut -f 1)
echo "Last firmware version: $LAST_FIRMWARE_VERSION"
echo -n "Enter new firmware version: "
RELEASE_VERSION=""
while [ -z "$RELEASE_VERSION" ]; do
read RELEASE_VERSION
done
source ~/export-esp.sh
EPOCH=$(date +%s)
RELEASE_BUILD="$RELEASE_VERSION" cargo build -r --no-default-features --features v3,sleep
mkdir -p /tmp/fkm-build &> /dev/null
espflash save-image --chip esp32c3 ./target/riscv32imc-unknown-none-elf/release/fkm-firmware "/tmp/fkm-build/v3_STATION_${RELEASE_VERSION}.bin"
./append_metadata.sh "/tmp/fkm-build/v3_STATION_${RELEASE_VERSION}.bin" "$RELEASE_VERSION" "STATION" "v3" "$EPOCH"
RELEASE_BUILD="$RELEASE_VERSION" cargo build -r --no-default-features --features v4,sleep
espflash save-image --chip esp32c3 ./target/riscv32imc-unknown-none-elf/release/fkm-firmware "/tmp/fkm-build/v4_STATION_${RELEASE_VERSION}.bin"
./append_metadata.sh "/tmp/fkm-build/v4_STATION_${RELEASE_VERSION}.bin" "$RELEASE_VERSION" "STATION" "v4" "$EPOCH"
cd $SCRIPT_DIR
echo "Version: $RELEASE_VERSION"
if gh release view "$RELEASE_VERSION" ; then
echo "Release already exists"
exit
fi
BUILD_FILES=$(ls /tmp/fkm-build/*_"$RELEASE_VERSION".bin)
if [ -z "$BUILD_FILES" ]; then
echo "No build files found"
exit
fi
gh release create "$RELEASE_VERSION" -t "$RELEASE_VERSION" --generate-notes
for file in $BUILD_FILES; do
echo "Uploading $file"
gh release upload "$RELEASE_VERSION" "$file"
done