Skip to content
File

Blob: build-releases.sh

bash33 lines
1#! /bin/bash
2set -euo pipefail
3 
4if [[ $(uname -m) == 'x86_64' ]]; then
5 echo "This _must_ be run on an Apple Silicon machine, since the macOS ARM build cannot be dockerised due to macOS license restrictions"
6 exit 1
7fi
8 
9rm -f workerd-darwin-arm64 workerd-darwin-arm64.gz
10rm -f workerd-linux-arm64 workerd-linux-arm64.gz
11 
12# Get the tag associated with the latest release, to ensure parity between binaries
13TAG_NAME=$(curl -sL https://api.github.com/repos/cloudflare/workerd/releases/latest | jq -r ".tag_name")
14 
15git checkout $TAG_NAME
16 
17# Build macOS binary
18pnpm exec bazel build --disk_cache=./.bazel-cache --config=release_macos //src/workerd/server:workerd
19 
20cp bazel-bin/src/workerd/server/workerd ./workerd-darwin-arm64
21 
22docker buildx build --platform linux/arm64 -f Dockerfile.release -t workerd:$TAG_NAME --target=artifact --output type=local,dest=$(pwd) .
23 
24chmod +x workerd*
25 
26mv workerd-darwin-arm64 workerd
27gzip -9N workerd
28mv workerd.gz workerd-darwin-arm64.gz
29 
30mv workerd-linux-arm64 workerd
31gzip -9N workerd
32mv workerd.gz workerd-linux-arm64.gz