forked from DieterReuter/image-builder-rpi64
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtravis-build.sh
executable file
·44 lines (37 loc) · 1.09 KB
/
travis-build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -e
# This script is meant to run on Travis-CI only
if [ -z "$TRAVIS_BRANCH" ]; then
echo "ABORTING: this script runs on Travis-CI only"
exit 1
fi
# Check essential envs
if [ -z "$GITHUB_TOKEN" ]; then
echo "ABORTING: env GITHUB_TOKEN is missing"
exit 1
fi
if [ -z "$GITHUB_OAUTH_TOKEN" ]; then
echo "ABORTING: env GITHUB_OAUTH_TOKEN is missing"
exit 1
fi
# verbose logging
set -x
# create a build number
export BUILD_NR="$(date '+%Y%m%d-%H%M%S')"
echo "BUILD_NR=$BUILD_NR"
# run build
#-create build dest
BUILD_DEST=builds/$BUILD_NR
mkdir -p $BUILD_DEST
#-build
###make shellcheck
VERSION=v$BUILD_NR make sd-image
#-move artifacts to build dest
mv hypriotos-rpi64* $BUILD_DEST/
# deploy to GitHub releases
export GIT_TAG=v$BUILD_NR
export GIT_RELTEXT="Auto-released by [Travis-CI build #$TRAVIS_BUILD_NUMBER](https://travis-ci.org/$TRAVIS_REPO_SLUG/builds/$TRAVIS_BUILD_ID)"
curl -sSL https://github.com/tcnksm/ghr/releases/download/v0.5.4/ghr_v0.5.4_linux_amd64.zip > ghr.zip
unzip ghr.zip
./ghr --version
./ghr --debug -u DieterReuter -b "$GIT_RELTEXT" $GIT_TAG builds/$BUILD_NR/