From 9d3852fae1559bc9ff3fdc94d390ceafa414f48f Mon Sep 17 00:00:00 2001 From: Neucrack Date: Fri, 19 Jul 2019 15:06:04 +0800 Subject: [PATCH] update auto release script --- .travis.yml | 10 +++---- tools/release/.gitignore | 1 + tools/release/release.sh | 59 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 tools/release/.gitignore create mode 100644 tools/release/release.sh diff --git a/.travis.yml b/.travis.yml index c42231264..238dfb6bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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}/ diff --git a/tools/release/.gitignore b/tools/release/.gitignore new file mode 100644 index 000000000..ba077a403 --- /dev/null +++ b/tools/release/.gitignore @@ -0,0 +1 @@ +bin diff --git a/tools/release/release.sh b/tools/release/release.sh new file mode 100644 index 000000000..19a834212 --- /dev/null +++ b/tools/release/release.sh @@ -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 +