comparison build_upload_win_nightly @ 1800:0d942ecf38c5

Post build results to discord via webhook
author Michael Pavone <pavone@retrodev.com>
date Mon, 25 Mar 2019 23:13:08 -0700
parents f249fd91b0f5
children 2efdace4fb8a
comparison
equal deleted inserted replaced
1799:ed6c38cd288c 1800:0d942ecf38c5
1 #!/bin/sh 1 #!/bin/sh
2 name=$1 2 name=$1
3 3 . "$HOME/$name.params"
4 cd $HOME/blastem_win 4 cd $HOME/blastem_win
5 hg revert -a 5 hg revert -a
6 hg pull 6 hg pull
7 hg up 7 hg up
8 rev=`hg summary | sed -E -n 's/^parent: [^:]+:([^ ]+) .*$/\1/p'` 8 rev=`hg summary | sed -E -n 's/^parent: [^:]+:([^ ]+) .*$/\1/p'`
10 export OS=Windows 10 export OS=Windows
11 ./build_release > /tmp/build_${name}_out.log 11 ./build_release > /tmp/build_${name}_out.log
12 result=$? 12 result=$?
13 if [ $result -ne 0 ]; then 13 if [ $result -ne 0 ]; then
14 echo Build falied with return code $result 14 echo Build falied with return code $result
15 curdate=`date -Iseconds`
16 curl -d'@-' -H 'Content-Type: application/json' "$WEBHOOKURL" <<WEBHOOKEOF
17 {
18 "embeds": [
19 {
20 "title": "Build $name failed!",
21 "type": "rich",
22 "description": "Build falied with return code $result"
23 "timestamp": "$curdate",
24 "color": 16711680,
25 }
26 ]
27 }
28 WEBHOOKEOF
15 exit $result 29 exit $result
16 fi 30 fi
17 . $HOME/remote.params 31 . $HOME/remote.params
18 artifact=$(tail -n 1 /tmp/build_${name}_out.log) 32 artifact=$(tail -n 1 /tmp/build_${name}_out.log)
19 echo "Uploaing $artifact to $REMOTE_HOST" 33 echo "Uploaing $artifact to $REMOTE_HOST"
20 scp -i "$REMOTE_IDENT" "$HOME/blastem_win/$artifact" $REMOTE_USER@$REMOTE_HOST:/home/$REMOTE_USER/nightlies 34 scp -i "$REMOTE_IDENT" "$HOME/blastem_win/$artifact" $REMOTE_USER@$REMOTE_HOST:/home/$REMOTE_USER/nightlies
35 curdate=`date -Iseconds`
36 version=`echo "$artifact" | sed -E 's/[^-]+-([0-9]+\.[0-9]+\.[0-9]+[^.]*)\..*$/\1/'`
37 curl -d'@-' -H 'Content-Type: application/json' "$WEBHOOKURL" <<WEBHOOKEOF
38 {
39 "embeds": [
40 {
41 "title": "New build of $name succeeded!",
42 "type": "rich",
43 "url": "https://www.retrodev.com/blastem/nightlies/$artifact"
44 "description": "Version: $version"
45 "timestamp": "$curdate",
46 "color": 65280,
47 }
48 ]
49 }
50 WEBHOOKEOF