File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- declare -a os_list=(" linux" " windows" " darwin" )
4- declare -a arc_list=(" amd64" " 386" )
3+ # Currently supported combinations of OS and Architecture
4+ declare -a builds=(
5+ " linux amd64"
6+ " linux 386"
7+ " linux s390x"
8+ " darwin amd64"
9+ " darwin 386"
10+ " windows amd64"
11+ " windows 386"
12+ )
13+
514build_file_name=${1:- " wsk" }
615zip_file_name=${2:- " OpenWhisk_CLI" }
716
8- for os in " ${os_list [@]} "
17+ for build in " ${builds [@]} "
918do
10- for arc in " ${arc_list[@]} "
11- do
12- wsk=$build_file_name
13- os_name=$os
14- if [ " $os " == " windows" ]; then
15- wsk=" $wsk .exe"
16- fi
17- if [ " $os " == " darwin" ]; then
18- os_name=" mac"
19- fi
20- cd $TRAVIS_BUILD_DIR
21- GOOS=$os GOARCH=$arc go build -ldflags " -X main.CLI_BUILD_TIME=` date -u ' +%Y-%m-%dT%H:%M:%S%:z' ` " -o build/$os /$arc /$wsk
22- cd build/$os /$arc
23- if [[ " $os " == " linux" ]]; then
24- tar -czvf " $TRAVIS_BUILD_DIR /$zip_file_name -$TRAVIS_TAG -$os_name -$arc .tgz" $wsk
25- else
26- zip -r " $TRAVIS_BUILD_DIR /$zip_file_name -$TRAVIS_TAG -$os_name -$arc .zip" $wsk
27- fi
28- done
19+ # A little bash foo to tokenize the build string
20+ IFS=' ' read os arc <<< " ${build}"
21+ wsk=$build_file_name
22+ os_name=$os
23+ if [ " $os " == " windows" ]; then
24+ wsk=" $wsk .exe"
25+ fi
26+ if [ " $os " == " darwin" ]; then
27+ os_name=" mac"
28+ fi
29+ cd $TRAVIS_BUILD_DIR || exit
30+ GOOS=$os GOARCH=$arc go build -ldflags " -X main.CLI_BUILD_TIME=` date -u ' +%Y-%m-%dT%H:%M:%S%:z' ` " -o build/$os /$arc /$wsk
31+ cd build/$os /$arc || exit
32+ if [[ " $os " == " linux" ]]; then
33+ tar -czvf " $TRAVIS_BUILD_DIR /$zip_file_name -$TRAVIS_TAG -$os_name -$arc .tgz" $wsk
34+ else
35+ zip -r " $TRAVIS_BUILD_DIR /$zip_file_name -$TRAVIS_TAG -$os_name -$arc .zip" $wsk
36+ fi
2937done
You can’t perform that action at this time.
0 commit comments