32 lines
570 B
Text
32 lines
570 B
Text
|
#!/bin/bash
|
||
|
|
||
|
set -eo pipefail
|
||
|
|
||
|
prepare_log() {
|
||
|
echo "[prepare release] -- $@"
|
||
|
}
|
||
|
|
||
|
if [ -z "$(git tag -l --points-at HEAD)" ]; then
|
||
|
prepare_log "Skipping non-tagged commit."
|
||
|
exit 0
|
||
|
fi
|
||
|
|
||
|
VERSION=$(git describe)
|
||
|
|
||
|
prepare_log "Preparing release for tagged version: $VERSION"
|
||
|
|
||
|
mkdir -p dist
|
||
|
|
||
|
if [ -d .pio/build ]; then
|
||
|
firmware_prefix=".pio/build"
|
||
|
else
|
||
|
firmware_prefix=".pioenvs"
|
||
|
fi
|
||
|
|
||
|
for file in $(ls ${firmware_prefix}/**/firmware.bin); do
|
||
|
env_dir=$(dirname "$file")
|
||
|
env=$(basename "$env_dir")
|
||
|
|
||
|
cp "$file" "dist/esp8266_milight_hub_${env}-${VERSION}.bin"
|
||
|
done
|