-
Notifications
You must be signed in to change notification settings - Fork 300
/
build-releases.sh
executable file
·32 lines (22 loc) · 1.03 KB
/
build-releases.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
#! /bin/bash
set -euo pipefail
if [[ $(uname -m) == 'x86_64' ]]; then
echo "This _must_ be run on an Apple Silicon machine, since the macOS ARM build cannot be dockerised due to macOS license restrictions"
exit 1
fi
rm -f workerd-darwin-arm64 workerd-darwin-arm64.gz
rm -f workerd-linux-arm64 workerd-linux-arm64.gz
# Get the tag associated with the latest release, to ensure parity between binaries
TAG_NAME=$(curl -sL https://api.github.com/repos/cloudflare/workerd/releases/latest | jq -r ".tag_name")
git checkout $TAG_NAME
# Build macOS binary
pnpm exec bazelisk build --disk_cache=./.bazel-cache --config=release_macos //src/workerd/server:workerd
cp bazel-bin/src/workerd/server/workerd ./workerd-darwin-arm64
docker buildx build --platform linux/arm64 -f Dockerfile.release -t workerd:$TAG_NAME --target=artifact --output type=local,dest=$(pwd) .
chmod +x workerd*
mv workerd-darwin-arm64 workerd
gzip -9N workerd
mv workerd.gz workerd-darwin-arm64.gz
mv workerd-linux-arm64 workerd
gzip -9N workerd
mv workerd.gz workerd-linux-arm64.gz