2019-11-03 19:00:28 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -x
|
|
|
|
set -e
|
|
|
|
|
|
|
|
VERSION="$1"
|
|
|
|
SRCDIR="$(pwd)"
|
|
|
|
NATIVE_TARBALL="zig-linux-$(uname -m)-$VERSION.tar.xz"
|
|
|
|
|
|
|
|
# Check for all the builds being completed. It's expected that this script is run several times
|
|
|
|
# before they are all complete.
|
|
|
|
AARCH64_LINUX_JSON_URL="https://ziglang.org/builds/aarch64-linux-$VERSION.json"
|
|
|
|
X86_64_LINUX_JSON_URL="https://ziglang.org/builds/x86_64-linux-$VERSION.json"
|
|
|
|
X86_64_WINDOWS_JSON_URL="https://ziglang.org/builds/x86_64-windows-$VERSION.json"
|
2021-04-10 22:20:22 +01:00
|
|
|
AARCH64_MACOS_JSON_URL="https://ziglang.org/builds/aarch64-macos-$VERSION.json"
|
2019-11-03 19:00:28 +00:00
|
|
|
X86_64_MACOS_JSON_URL="https://ziglang.org/builds/x86_64-macos-$VERSION.json"
|
|
|
|
X86_64_FREEBSD_JSON_URL="https://ziglang.org/builds/x86_64-freebsd-$VERSION.json"
|
2021-07-12 18:12:09 +01:00
|
|
|
X86_64_NETBSD_JSON_URL="https://ziglang.org/builds/x86_64-netbsd-$VERSION.json"
|
2019-11-03 19:00:28 +00:00
|
|
|
|
|
|
|
# If any of these fail, it's not really this job failing; rather we have detected
|
|
|
|
# that this job will be called again later when other jobs have completed.
|
2019-11-04 02:44:39 +00:00
|
|
|
curl --fail -I "$AARCH64_LINUX_JSON_URL" >/dev/null || exit 0
|
|
|
|
curl --fail -I "$X86_64_LINUX_JSON_URL" >/dev/null || exit 0
|
|
|
|
curl --fail -I "$X86_64_WINDOWS_JSON_URL" >/dev/null || exit 0
|
2021-04-10 22:20:22 +01:00
|
|
|
curl --fail -I "$AARCH64_MACOS_JSON_URL" >/dev/null || exit 0
|
2019-11-04 02:44:39 +00:00
|
|
|
curl --fail -I "$X86_64_MACOS_JSON_URL" >/dev/null || exit 0
|
2020-03-06 04:37:29 +00:00
|
|
|
curl --fail -I "$X86_64_FREEBSD_JSON_URL" >/dev/null || exit 0
|
2021-07-12 18:12:09 +01:00
|
|
|
curl --fail -I "$X86_64_NETBSD_JSON_URL" >/dev/null || exit 0
|
2019-11-04 02:44:39 +00:00
|
|
|
|
|
|
|
# Without --user, this gave me:
|
|
|
|
# ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied
|
|
|
|
pip3 install s3cmd --user
|
2019-11-04 05:07:27 +00:00
|
|
|
S3CMD="$HOME/.local/bin/s3cmd"
|
2019-11-03 19:00:28 +00:00
|
|
|
|
2021-01-07 23:49:13 +00:00
|
|
|
# This is the user when pushing to the website repo.
|
|
|
|
git config --global user.email "ziggy@ziglang.org"
|
|
|
|
git config --global user.name "Ziggy"
|
|
|
|
|
|
|
|
# Refresh this with `ssh-keyscan github.com` from a trusted Internet connection.
|
|
|
|
# We hard code the public key here to detect man-in-the-middle attacks.
|
|
|
|
echo "github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==" >> ~/.ssh/known_hosts
|
|
|
|
|
|
|
|
# We don't want the .git folder inside the tarball.
|
2019-11-03 19:00:28 +00:00
|
|
|
rm -rf .git
|
|
|
|
|
|
|
|
cd "$HOME"
|
|
|
|
wget "https://ziglang.org/builds/$NATIVE_TARBALL"
|
|
|
|
tar xf "$NATIVE_TARBALL"
|
2021-01-07 23:49:13 +00:00
|
|
|
ZIGDIR="$(pwd)/$(basename $NATIVE_TARBALL .tar.xz)"
|
2019-11-03 19:00:28 +00:00
|
|
|
ZIG="$ZIGDIR/zig"
|
2021-01-07 06:17:00 +00:00
|
|
|
LANGREF="$ZIGDIR/docs/langref.html"
|
2019-11-03 19:00:28 +00:00
|
|
|
SRCTARBALLDIR="zig-$VERSION"
|
|
|
|
export SRC_TARBALL="$SRCTARBALLDIR.tar.xz"
|
|
|
|
mv "$SRCDIR" "$SRCTARBALLDIR"
|
|
|
|
tar cfJ "$SRC_TARBALL" "$SRCTARBALLDIR"
|
|
|
|
export SRC_SHASUM=$(sha256sum $SRC_TARBALL | cut '-d ' -f1)
|
|
|
|
export SRC_BYTESIZE=$(wc -c < $SRC_TARBALL)
|
|
|
|
|
2019-11-04 03:01:59 +00:00
|
|
|
X86_64_WINDOWS_JSON=$(curl --fail "$X86_64_WINDOWS_JSON_URL" || exit 1)
|
2019-11-03 19:00:28 +00:00
|
|
|
export X86_64_WINDOWS_TARBALL="$(echo "$X86_64_WINDOWS_JSON" | jq .tarball -r)"
|
|
|
|
export X86_64_WINDOWS_BYTESIZE="$(echo "$X86_64_WINDOWS_JSON" | jq .size -r)"
|
|
|
|
export X86_64_WINDOWS_SHASUM="$(echo "$X86_64_WINDOWS_JSON" | jq .shasum -r)"
|
|
|
|
|
2021-04-10 22:20:22 +01:00
|
|
|
AARCH64_MACOS_JSON=$(curl --fail "$AARCH64_MACOS_JSON_URL" || exit 1)
|
|
|
|
export AARCH64_MACOS_TARBALL="$(echo "$AARCH64_MACOS_JSON" | jq .tarball -r)"
|
|
|
|
export AARCH64_MACOS_BYTESIZE="$(echo "$AARCH64_MACOS_JSON" | jq .size -r)"
|
|
|
|
export AARCH64_MACOS_SHASUM="$(echo "$AARCH64_MACOS_JSON" | jq .shasum -r)"
|
|
|
|
|
2019-11-04 03:01:59 +00:00
|
|
|
X86_64_MACOS_JSON=$(curl --fail "$X86_64_MACOS_JSON_URL" || exit 1)
|
2019-11-03 19:00:28 +00:00
|
|
|
export X86_64_MACOS_TARBALL="$(echo "$X86_64_MACOS_JSON" | jq .tarball -r)"
|
|
|
|
export X86_64_MACOS_BYTESIZE="$(echo "$X86_64_MACOS_JSON" | jq .size -r)"
|
|
|
|
export X86_64_MACOS_SHASUM="$(echo "$X86_64_MACOS_JSON" | jq .shasum -r)"
|
|
|
|
|
2019-11-04 03:01:59 +00:00
|
|
|
X86_64_LINUX_JSON=$(curl --fail "$X86_64_LINUX_JSON_URL" || exit 1)
|
2019-11-03 19:00:28 +00:00
|
|
|
export X86_64_LINUX_TARBALL="$(echo "$X86_64_LINUX_JSON" | jq .tarball -r)"
|
|
|
|
export X86_64_LINUX_BYTESIZE="$(echo "$X86_64_LINUX_JSON" | jq .size -r)"
|
|
|
|
export X86_64_LINUX_SHASUM="$(echo "$X86_64_LINUX_JSON" | jq .shasum -r)"
|
|
|
|
|
2019-11-04 03:01:59 +00:00
|
|
|
AARCH64_LINUX_JSON=$(curl --fail "$AARCH64_LINUX_JSON_URL" || exit 1)
|
2019-11-03 19:00:28 +00:00
|
|
|
export AARCH64_LINUX_TARBALL="$(echo "$AARCH64_LINUX_JSON" | jq .tarball -r)"
|
|
|
|
export AARCH64_LINUX_BYTESIZE="$(echo "$AARCH64_LINUX_JSON" | jq .size -r)"
|
|
|
|
export AARCH64_LINUX_SHASUM="$(echo "$AARCH64_LINUX_JSON" | jq .shasum -r)"
|
|
|
|
|
2020-03-06 04:37:29 +00:00
|
|
|
X86_64_FREEBSD_JSON=$(curl --fail "$X86_64_FREEBSD_JSON_URL" || exit 1)
|
|
|
|
export X86_64_FREEBSD_TARBALL="$(echo "$X86_64_FREEBSD_JSON" | jq .tarball -r)"
|
|
|
|
export X86_64_FREEBSD_BYTESIZE="$(echo "$X86_64_FREEBSD_JSON" | jq .size -r)"
|
|
|
|
export X86_64_FREEBSD_SHASUM="$(echo "$X86_64_FREEBSD_JSON" | jq .shasum -r)"
|
2019-11-03 19:00:28 +00:00
|
|
|
|
2021-07-12 18:12:09 +01:00
|
|
|
X86_64_NETBSD_JSON=$(curl --fail "$X86_64_NETBSD_JSON_URL" || exit 1)
|
|
|
|
export X86_64_NETBSD_TARBALL="$(echo "$X86_64_NETBSD_JSON" | jq .tarball -r)"
|
|
|
|
export X86_64_NETBSD_BYTESIZE="$(echo "$X86_64_NETBSD_JSON" | jq .size -r)"
|
|
|
|
export X86_64_NETBSD_SHASUM="$(echo "$X86_64_NETBSD_JSON" | jq .shasum -r)"
|
2021-06-11 06:43:58 +01:00
|
|
|
|
2021-01-07 23:49:13 +00:00
|
|
|
export MASTER_DATE="$(date +%Y-%m-%d)"
|
|
|
|
export MASTER_VERSION="$VERSION"
|
|
|
|
|
2021-07-12 06:13:26 +01:00
|
|
|
# Create index.json and update the website repo.
|
2021-01-07 23:49:13 +00:00
|
|
|
cd "$SRCTARBALLDIR/ci/srht"
|
|
|
|
"$ZIG" run update-download-page.zig
|
|
|
|
CIDIR="$(pwd)"
|
2021-01-07 19:28:55 +00:00
|
|
|
|
2021-01-07 23:49:13 +00:00
|
|
|
cd "$HOME"
|
2021-07-12 06:13:26 +01:00
|
|
|
git clone --depth 1 git@github.com:ziglang/www.ziglang.org.git
|
2019-11-03 19:00:28 +00:00
|
|
|
cd www.ziglang.org
|
2021-01-07 23:49:13 +00:00
|
|
|
WWWDIR="$(pwd)"
|
2019-11-03 19:00:28 +00:00
|
|
|
|
2021-01-07 23:49:13 +00:00
|
|
|
$S3CMD put -P --no-mime-magic --add-header="cache-control: public, max-age=31536000, immutable" "$HOME/$SRC_TARBALL" s3://ziglang.org/builds/
|
2021-01-07 06:17:00 +00:00
|
|
|
|
2021-01-07 23:49:13 +00:00
|
|
|
cd "$WWWDIR"
|
|
|
|
cp "$CIDIR/out/index.json" data/releases.json
|
2021-01-12 20:26:52 +00:00
|
|
|
mkdir -p content/documentation/master/std
|
|
|
|
cp "$LANGREF" content/documentation/master/index.html
|
|
|
|
cp "$ZIGDIR/docs/std/index.html" content/documentation/master/std/index.html
|
|
|
|
cp "$ZIGDIR/docs/std/data.js" content/documentation/master/std/data.js
|
|
|
|
cp "$ZIGDIR/docs/std/main.js" content/documentation/master/std/main.js
|
2021-01-07 06:17:00 +00:00
|
|
|
git add data/releases.json
|
2021-01-12 20:26:52 +00:00
|
|
|
git add content/
|
|
|
|
git commit -m "CI: update releases and docs"
|
|
|
|
git push origin master
|