Files
qmk/util/travis_compiled_push.sh
T

91 lines
2.8 KiB
Bash
Raw Normal View History

#!/bin/bash
2019-11-05 00:18:57 +00:00
source util/travis_utils.sh
source util/travis_push.sh
2018-03-29 14:47:02 -07:00
set -o errexit -o nounset
rev=$(git rev-parse --short HEAD)
2018-12-25 16:40:53 -08:00
echo "Using git hash ${rev}"
2018-03-29 14:47:02 -07:00
if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; then
2019-07-09 15:47:18 -07:00
# fix formatting
2017-08-21 23:39:06 -04:00
git checkout master
git diff --diff-filter=AM --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | xargs -0 dos2unix
git diff --diff-filter=AM --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} '*.c' '*.h' '*.cpp' | grep -z -e '^drivers' -e '^quantum' -e '^tests' -e '^tmk_core' | grep -zv -e 'quantum/template' -e 'tmk_core/protocol/usb_hid' | xargs -0 clang-format-7 -i
git diff --diff-filter=AM --name-only -n 1 -z ${TRAVIS_COMMIT_RANGE} | xargs -0 git add
git commit -m "format code according to conventions [skip ci]" && git push git@github.com:qmk/qmk_firmware.git master
2018-03-29 14:47:02 -07:00
increment_version ()
{
declare -a part=( ${1//\./ } )
part[2]=$((part[2] + 1))
new="${part[*]}"
echo -e "${new// /.}"
2018-12-25 16:40:53 -08:00
}
2017-07-02 23:38:20 -04:00
git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE}
2018-03-24 18:34:34 -07:00
NEFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ev '^(keyboards/)' | grep -Ev '^(docs/)' | grep -Ev '^(users/)' | grep -Ev '^(layouts/)' | wc -l)
if [[ $NEFM -gt 0 ]] ; then
echo "Essential files modified."
2017-02-06 17:51:20 -05:00
git fetch --tags
lasttag=$(git tag --sort=-creatordate --no-column --list '*.*.*' | grep -E -m1 '^[0-9]+\.[0-9]+\.[0-9]+$')
newtag=$(increment_version $lasttag)
2017-11-14 16:47:34 -05:00
until git tag $newtag; do
newtag=$(increment_version $newtag)
done
2017-05-29 12:14:49 -04:00
git push --tags git@github.com:qmk/qmk_firmware.git
else
echo "No essential files modified."
fi
2017-02-06 16:42:18 -05:00
if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then
2017-11-14 22:14:59 -05:00
make generate-keyboards-file SILENT=true > .keyboards
2017-02-06 16:42:18 -05:00
cd ..
2017-05-28 16:16:56 -04:00
git clone git@github.com:qmk/qmk.fm.git
2017-02-06 16:42:18 -05:00
cd qmk.fm
2017-08-21 21:57:46 -04:00
mv ../qmk_firmware/id_rsa_qmk.fm id_rsa_qmk.fm
2017-11-14 22:14:59 -05:00
mv ../qmk_firmware/.keyboards .
ssh-add -D
eval `ssh-agent -s`
2017-08-21 21:57:46 -04:00
ssh-add id_rsa_qmk.fm
2018-12-25 16:40:53 -08:00
2017-11-17 14:09:27 -05:00
# don't delete files in case not all keyboards are built
# rm -f compiled/*.hex
2017-08-23 15:44:17 -04:00
# ignore errors here
2019-05-28 20:38:47 +02:00
# In theory, this is more flexible, and will allow for additional expansion of additional types of files and other names
mv ../qmk_firmware/*_default.*{hex,bin} ./compiled/ || true
# get the list of keyboards
readarray -t keyboards < .keyboards
# replace / with _
keyboards=("${keyboards[@]//[\/]/_}")
# remove all binaries that don't belong to a keyboard in .keyboards
for file in "./compiled"/* ; do
match=0
for keyboard in "${keyboards[@]}" ; do
if [[ ${file##*/} = "${keyboard}_default.bin" ]] || [[ ${file##*/} = "${keyboard}_default.hex" ]]; then
match=1
break
fi
done
if [[ $match = 0 ]]; then
echo "Removing deprecated binary: $file"
rm "$file"
fi
done
2017-11-14 22:31:34 -05:00
bash _util/generate_keyboard_page.sh
2017-02-06 16:42:18 -05:00
git add -A
2018-12-25 16:40:53 -08:00
git commit -m "generated from qmk/qmk_firmware@${rev}"
2017-05-29 12:49:25 -04:00
git push git@github.com:qmk/qmk.fm.git
2018-03-29 14:47:02 -07:00
fi
2017-02-06 16:56:39 -05:00
fi