github.com/joshdk/godel@v0.0.0-20170529232908-862138a45aee/godel/config/dist.yml (about) 1 products: 2 distgo: 3 build: 4 output-dir: ./apps/distgo/build 5 main-pkg: ./apps/distgo/main/distgo 6 environment: 7 CGO_ENABLED: "0" 8 version-var: github.com/palantir/godel/cmd/godel.Version 9 dist: 10 output-dir: ./apps/distgo/dist 11 dist-type: 12 type: os-arch-bin 13 gonform: 14 build: 15 output-dir: ./apps/gonform/build 16 main-pkg: ./apps/gonform/main/gonform 17 environment: 18 CGO_ENABLED: "0" 19 version-var: github.com/palantir/godel/cmd/godel.Version 20 dist: 21 output-dir: ./apps/gonform/dist 22 dist-type: 23 type: os-arch-bin 24 gunit: 25 build: 26 output-dir: ./apps/gunit/build 27 main-pkg: ./apps/gunit/main/gunit 28 environment: 29 CGO_ENABLED: "0" 30 version-var: github.com/palantir/godel/cmd/godel.Version 31 dist: 32 output-dir: ./apps/gunit/dist 33 dist-type: 34 type: os-arch-bin 35 okgo: 36 build: 37 output-dir: ./apps/okgo/build 38 main-pkg: ./apps/okgo/main/okgo 39 environment: 40 CGO_ENABLED: "0" 41 version-var: github.com/palantir/godel/cmd/godel.Version 42 dist: 43 output-dir: ./apps/okgo/dist 44 dist-type: 45 type: os-arch-bin 46 godel: 47 build: 48 main-pkg: ./main/godel 49 environment: 50 CGO_ENABLED: "0" 51 os-archs: 52 - os: darwin 53 arch: amd64 54 - os: linux 55 arch: amd64 56 version-var: github.com/palantir/godel/cmd/godel.Version 57 dist: 58 dist-type: 59 type: bin 60 info: 61 omit-init-sh: true 62 script: | 63 set -euo pipefail 64 65 # computes the SHA-256 hash of the provided file. Uses openssl, shasum or sha1sum program. 66 function compute_sha256 { 67 local file=$1 68 if command -v openssl >/dev/null 2>&1; then 69 # print SHA-256 hash using openssl 70 openssl dgst -sha256 "$file" | sed -E 's/SHA256\(.*\)= //' 71 elif command -v shasum >/dev/null 2>&1; then 72 # Darwin systems ship with "shasum" utility 73 shasum -a 256 "$file" | sed -E 's/[[:space:]]+.+//' 74 elif command -v sha256sum >/dev/null 2>&1; then 75 # Most Linux systems ship with sha256sum utility 76 sha256sum "$file" | sed -E 's/[[:space:]]+.+//' 77 else 78 echo "Could not find program to calculate SHA-256 checksum for file" 79 exit 1 80 fi 81 } 82 83 # replaces all occurrences of the string "{{VERSION}}" in the provided file with the value of $VERSION 84 function substitute_version { 85 local file=$1 86 substitute_variable "{{VERSION}}" "$VERSION" "$file" 87 } 88 89 # replaces all occurrences of the string "{{CHECKSUM_$1}}" in the provided file with the value computed 90 # for the checksum of the binary for the OS/Arch combination specified by $1. 91 function substitute_checksum { 92 local os_arch=$1 93 local file=$2 94 local checksum=$(compute_sha256 "$DIST_DIR/bin/$os_arch/godel") 95 substitute_variable "{{CHECKSUM_$os_arch}}" "$checksum" "$file" 96 } 97 98 # replaces all occurrences of the first argument with the value of the second argument in the file 99 # provided as the third argument. 100 function substitute_variable { 101 local variable=$1 102 local value=$2 103 local file=$3 104 105 local tmpFile=$file-$RANDOM.tmp 106 cp -p $file $tmpFile 107 sed 's|'"$variable"'|'"$value"'|' "$file" > "$tmpFile" 108 mv "$tmpFile" "$file" 109 } 110 111 function setup_wrapper { 112 local wrapper_dir=$1 113 114 # copy contents of resources directory 115 mkdir -p "$wrapper_dir" 116 cp -r "$PROJECT_DIR/resources/wrapper"/* "$wrapper_dir" 117 118 # substitute version for godelw 119 substitute_version "$wrapper_dir/godelw" 120 121 # substitute checksums for godelw 122 substitute_checksum darwin-amd64 "$wrapper_dir/godelw" 123 substitute_checksum linux-amd64 "$wrapper_dir/godelw" 124 125 # substitute the URL in the properties file 126 REPO="" 127 if [ "$IS_SNAPSHOT" == "1" ]; then 128 REPO="releases-internal" 129 else 130 REPO="releases" 131 fi 132 PROPERTIES_FILE="$wrapper_dir/godel/config/godel.properties" 133 URL="https://palantir.bintray.com/${REPO}/com/palantir/godel/godel/${VERSION}/godel-${VERSION}.tgz" 134 substitute_variable "{{URL}}" "$URL" "$PROPERTIES_FILE" 135 } 136 137 # copy contents of resources directory 138 mkdir -p "$DIST_DIR/wrapper" 139 setup_wrapper "$DIST_DIR/wrapper" 140 group-id: com.palantir.godel