File
Blob: build-releases.sh
| 1 | #! /bin/bash |
| 2 | set -euo pipefail |
| 3 | |
| 4 | if [[ $(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 |
| 7 | fi |
| 8 | |
| 9 | rm -f workerd-darwin-arm64 workerd-darwin-arm64.gz |
| 10 | rm -f workerd-linux-arm64 workerd-linux-arm64.gz |
| 11 | |
| 12 | # Get the tag associated with the latest release, to ensure parity between binaries |
| 13 | TAG_NAME=$(curl -sL https://api.github.com/repos/cloudflare/workerd/releases/latest | jq -r ".tag_name") |
| 14 | |
| 15 | git checkout $TAG_NAME |
| 16 | |
| 17 | # Build macOS binary |
| 18 | pnpm exec bazel build --disk_cache=./.bazel-cache --config=release_macos //src/workerd/server:workerd |
| 19 | |
| 20 | cp bazel-bin/src/workerd/server/workerd ./workerd-darwin-arm64 |
| 21 | |
| 22 | docker buildx build --platform linux/arm64 -f Dockerfile.release -t workerd:$TAG_NAME --target=artifact --output type=local,dest=$(pwd) . |
| 23 | |
| 24 | chmod +x workerd* |
| 25 | |
| 26 | mv workerd-darwin-arm64 workerd |
| 27 | gzip -9N workerd |
| 28 | mv workerd.gz workerd-darwin-arm64.gz |
| 29 | |
| 30 | mv workerd-linux-arm64 workerd |
| 31 | gzip -9N workerd |
| 32 | mv workerd.gz workerd-linux-arm64.gz |