Skip to content

Commit

Permalink
update auto release script
Browse files Browse the repository at this point in the history
  • Loading branch information
Neutree committed Jul 19, 2019
1 parent 9f3862f commit 9d3852f
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 6 deletions.
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ jobs:
- sudo tar -Jxvf kendryte-toolchain-ubuntu-amd64-8.2.0-20190409.tar.xz -C /opt
script:
- echo "TRAVIS_BRANCH=$TRAVIS_BRANCH, BRANCH=$BRANCH"
- cd projects/maixpy_k210
- python project.py build
- cd tools/release
- ./release.sh
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then exit 0; fi
- time_now=$(date "+%Y_%m_%d_%H_%M_%S")
- firmware_name=maixpy_${curr_branch}_${time_now}_${rev}.bin && echo ${firmware_name}
- cd build
- mv maixpy.bin $firmware_name
- firmware_dir=`ls bin/`
- sudo sh -c "echo StrictHostKeyChecking no >>/etc/ssh/ssh_config"
- sshpass -p ${USER_PASSWD} scp $firmware_name ${SERVER_USER}@${SERVER_ADDR}:${SERVER_FOLDER_PATH}/${curr_branch}/
- sshpass -p ${USER_PASSWD} scp -r $firmware_dir ${SERVER_USER}@${SERVER_ADDR}:${SERVER_FOLDER_PATH}/${curr_branch}/
1 change: 1 addition & 0 deletions tools/release/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin
59 changes: 59 additions & 0 deletions tools/release/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

set -e

#
dirty=`git describe --long --tag --dirty --always | awk -F "-" '{print $4}'`
version_full=`git describe --long --tag --dirty --always`
version=`echo $version_full | awk -F "-" '{print $1}'`
version_dev=`echo $version_full | awk -F "-" '{print $2}'`
version_git_rev=`echo $version_full | awk -F "-" '{print $3}'`
if [[ "x$version_dev" != "x" ]]; then
version=${version}_${version_dev}_${version_git_rev}
fi
if [[ "x$dirty" == "xdirty" ]]; then
echo -e "\033[33m [WARNING] coding is dirty!!, please commit all code firstly \033[0m"
version=${version}_dirty
fi
echo $version_full
echo $version

release_dir=`pwd`/bin/maixpy_$version
rm -rf $release_dir $release_dir/elf
mkdir $release_dir
mkdir $release_dir/elf

#
cd ../../projects

#
cd maixpy_k210
# python project.py distclean
# python project.py build
cp build/maixpy.bin $release_dir/maixpy_$version.bin
cp build/maixpy.elf $release_dir/elf/maixpy_$version.elf
cd ..
#

#
cd maixpy_k210_minimum
# python project.py distclean
# python project.py build
cp build/maixpy.bin $release_dir/maixpy_${version}_minimum.bin
cp build/maixpy.elf $release_dir/elf/maixpy_${version}_minimum.elf
cd ..

#
cd maixpy_m5stick
# python project.py distclean
# python project.py build
cp build/maixpy.bin $release_dir/maixpy_${version}_m5stickv.bin
cp build/maixpy.elf $release_dir/elf/maixpy_${version}_m5stickv.elf
cd ..

cd $release_dir
7z a elf_maixpy_${version}.7z elf/*
rm -rf elf

ls -al

0 comments on commit 9d3852f

Please sign in to comment.