-
Notifications
You must be signed in to change notification settings - Fork 35
/
release.sh
executable file
·56 lines (38 loc) · 1.46 KB
/
release.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
#!/bin/bash
set -e
if [[ -n "$(git status --porcelain)" ]]; then
echo -e "commit/stash changes first\n"
git status
exit 1
fi
gitid=$(git log -1 --pretty=format:"%h")
date=$(date +%F)
vmaj=$(sed -n 's/^#define FW_MAJOR_V \([0-9]\)$/\1/p' youyue858d.ino)
vmia=$(sed -n 's/^#define FW_MINOR_V_A \([0-9]\)$/\1/p' youyue858d.ino)
vmib=$(sed -n 's/^#define FW_MINOR_V_B \([0-9]\)$/\1/p' youyue858d.ino)
vers="V${vmaj}.${vmia}${vmib}"
if [[ -z ${vmaj} || -z ${vmia} || -z ${vmib} ]]; then
echo "no valid version found: ${vmaj:-x}.${vmia:-x}${vmib:-x}"
exit 2
fi
vline=$(head -n 5 youyue858d.ino | tail -n 1)
echo "vline: '$vline'"
if [[ ${vline} != " * ${vers}" ]]; then
echo "invalid version in line 5!"
exit 2
fi
indent -linux -l150 youyue858d.ino
indent -linux -l150 youyue858d.h
file328="${date}__commit-${gitid}__ATmega328P-8MHz-RC-osc__FUSES-0xE2-0xDF-0xFD__${vers}-WDT.hex"
file168="${date}__commit-${gitid}__ATmega168-8MHz-RC-osc__FUSES-0xE2-0xDD-0xFD__${vers}-WDT.hex"
echo "processing ${vers}...".
make BOARD_SUB=atmega168
make BOARD_SUB=atmega328
git rm -f binaries/*hex || true
cp build-lilypad-atmega328/Youyue-858D-plus.hex binaries/${file328}
cp build-lilypad-atmega168/Youyue-858D-plus.hex binaries/${file168}
cd binaries
sha1sum ${file168} ${file328} > SHA1SUMS.TXT
git add -f ${file168} ${file328} SHA1SUMS.TXT
git commit -m "release binaries ${vers}"
git tag -a "v${vmaj}.${vmia}${vmib}" -m "$(git log -1 --skip=1 --pretty=format:"%B")"