-
Notifications
You must be signed in to change notification settings - Fork 436
/
publish-release.sh
executable file
·48 lines (40 loc) · 1.23 KB
/
publish-release.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
45
46
47
48
#!/bin/bash
set -e
if [[ -z "$GITHUB_TOKEN" ]]; then
echo "GITHUB_TOKEN not found in environment"
exit 1
fi
TAG=$1
if [[ -z "$TAG" ]]; then
echo "Expected release tag to be passed as the first argument"
exit 1
fi
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Invalid release tag: $TAG"
exit 1
fi
echo "Generating proxy binaries"
cd go
rm -rf dist
mkdir -p dist
GOOS=linux GOARCH=amd64 go build -o "dist/grpcwebproxy-$TAG-linux-x86_64" ./grpcwebproxy
GOOS=windows GOARCH=amd64 go build -o "dist/grpcwebproxy-$TAG-win64.exe" ./grpcwebproxy
GOOS=windows GOARCH=386 go build -o "dist/grpcwebproxy-$TAG-win32.exe" ./grpcwebproxy
GOOS=darwin GOARCH=amd64 go build -o "dist/grpcwebproxy-$TAG-osx-x86_64" ./grpcwebproxy
for f in dist/*; do zip -9r "$f.zip" "$f"; done
ls -l ./dist
cd ..
echo "Generating client binaries"
npm run clean
npm install
echo "Publishing $TAG"
# Create github release and attach server binaries
./node_modules/.bin/github-release upload \
--owner improbable-eng \
--repo grpc-web \
--tag "$TAG" \
--name "$TAG" \
--body "See [CHANGELOG](https://github.com/improbable-eng/grpc-web/blob/master/CHANGELOG.md) for details" \
go/dist/*.zip
# Publish client modules to NPM.
npx lerna publish $TAG --yes