]> git.donarmstrong.com Git - qmk_firmware.git/blob - util/travis_compiled_push.sh
Adding docker compose
[qmk_firmware.git] / util / travis_compiled_push.sh
1 #!/bin/bash
2
3 set -o errexit -o nounset
4
5 rev=$(git rev-parse --short HEAD)
6
7 if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]] ; then
8
9 git config --global user.name "QMK Bot"
10 git config --global user.email "hello@qmk.fm"
11
12 openssl aes-256-cbc -K $encrypted_b0ee987fd0fc_key -iv $encrypted_b0ee987fd0fc_iv -in secrets.tar.enc -out secrets.tar -d
13 tar xvf secrets.tar
14
15 chmod 600 id_rsa_qmk_firmware
16 chmod 600 qmk.fm
17 eval `ssh-agent -s`
18 ssh-add id_rsa_qmk_firmware
19
20 increment_version ()
21 {
22   declare -a part=( ${1//\./ } )
23   part[2]=$((part[2] + 1))
24   new="${part[*]}"
25   echo -e "${new// /.}"
26
27
28 NEFM=$(git diff --name-only -n 1 ${TRAVIS_COMMIT_RANGE} | grep -Ev '^(keyboards/)' | grep -Ev '^(docs/)' | wc -l)
29 if [[ $NEFM -gt 0 ]] ; then
30         echo "Essential files modified."
31         git fetch --tags
32         lasttag=$(git tag | grep -Ev '\-' | xargs -I@ git log --format=format:"%ai @%n" -1 @ | sort -V | awk '{print $4}' | tail -1)
33         newtag=$(increment_version $lasttag)
34         git tag $newtag
35         git push --tags git@github.com:qmk/qmk_firmware.git
36 else
37         echo "No essential files modified."
38 fi
39
40 if [[ "$TRAVIS_COMMIT_MESSAGE" != *"[skip build]"* ]] ; then
41
42         make ergodox-ez AUTOGEN=true
43
44         cd ..
45         git clone git@github.com:qmk/qmk.fm.git
46         cd qmk.fm
47         ssh-add ../qmk_firmware/qmk.fm
48         #git submodule update --init --recursive
49         #rm -rf keyboard
50         #rm -rf keyboards
51         #yes | cp -rf ../qmk_firmware/keyboards .
52         #mkdir keyboards/ergodox_ez/
53         #cp ../qmk_firmware/util/ergodox_ez.html keyboards/ergodox_ez/index.html
54         #cp ../qmk_firmware/readme.md qmk_readme.md
55         #./generate.sh
56         rm -f _compiled/*.hex
57         for file in ../qmk_firmware/keyboards/*/keymaps/*/*.hex; do mv -v "$file" "_compiled/${file##*/}"; done
58
59         git add -A
60         git commit -m "generated from qmk/qmk_firmware@${rev}" 
61         git push git@github.com:qmk/qmk.fm.git
62
63 fi
64
65 fi