Debian Codegraph @

release.sh

raw symbols SCIP
1 #!/bin/bash
2
3 set -e
4
5 VERSION="0.4.0"
6
7 rm -rf dist
8 mkdir dist
9
10 for ENV in $( go tool dist list | grep -v 'android' | grep -v 'darwin/arm' | grep -v 's390x' | grep -v 'plan9/arm'); do
11 eval $( echo $ENV | tr '/' ' ' | xargs printf 'export GOOS=%s; export GOARCH=%s\n' )
12
13 GOOS=${GOOS:-linux}
14 GOARCH=${GOARCH:-amd64}
15
16 BIN="pup"
17 if [ ${GOOS} == "windows" ]; then
18 BIN="pup.exe"
19 fi
20
21 mkdir -p dist
22
23 echo "Building for GOOS=$GOOS GOARCH=$GOARCH"
24
25 sudo rkt run \
26 --set-env=GOOS=${GOOS} \
27 --set-env=GOARCH=${GOARCH} \
28 --set-env=CGO_ENABLED=0 \
29 --volume pup,kind=host,source=${PWD} \
30 --mount volume=pup,target=/go/src/github.com/ericchiang/pup \
31 --insecure-options=image \
32 docker://golang:1.6.3 \
33 --exec go -- build -v -a \
34 -o /go/src/github.com/ericchiang/pup/dist/${BIN} \
35 github.com/ericchiang/pup
36
37 sudo rkt gc --grace-period=0s
38
39 zip dist/pup_v${VERSION}_${GOOS}_${GOARCH}.zip -j dist/${BIN}
40 rm -f dist/${BIN}
41 done
42
43 DARWIN_AMD64=pup_v${VERSION}_darwin_amd64.zip
44 DARWIN_386=pup_v${VERSION}_darwin_386.zip
45
46 cat << EOF > pup.rb
47 # This file was generated by release.sh
48 require 'formula'
49 class Pup < Formula
50 homepage 'https://github.com/ericchiang/pup'
51 version '0.4.0'
52
53 if Hardware::CPU.is_64_bit?
54 url 'https://github.com/ericchiang/pup/releases/download/v${VERSION}/${DARWIN_AMD64}'
55 sha256 '$( sha256sum dist/${DARWIN_AMD64} | awk '{ print $1 }' | xargs printf )'
56 else
57 url 'https://github.com/ericchiang/pup/releases/download/v${VERSION}/${DARWIN_386}'
58 sha256 '$( sha256sum dist/${DARWIN_386} | awk '{ print $1 }' | xargs printf )'
59 end
60
61 def install
62 bin.install 'pup'
63 end
64 end
65 EOF