zig/ci/azure/update_download_page

34 lines
1.0 KiB
Bash
Executable File

#!/bin/sh
set -x
set -e
SRCDIR=$(pwd)
rm -rf .git
sudo apt-get install -y s3cmd
cd "$HOME"
wget "https://ziglang.org/builds/$LINUX_TARBALL"
tar xf $LINUX_TARBALL
ZIGDIR=$(basename -s .tar.xz $LINUX_TARBALL)
ZIG="$ZIGDIR/zig"
LANGREF="$ZIGDIR/langref.html"
VERSION=$($ZIG version)
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)
git clone https://github.com/ziglang/www.ziglang.org --depth 1
cd www.ziglang.org
export MASTER_DATE=$(date +%Y-%m-%d)
env
"../$ZIG" run update-download-page.zig
mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
s3cmd put -P "../$SRC_TARBALL" s3://ziglang.org/builds/
s3cmd put -P "../$LANGREF" s3://ziglang.org/documentation/master/index.html --add-header="Cache-Control: max-age=0, must-revalidate"
s3cmd put -P www/download/index.html s3://ziglang.org/download/index.html --add-header="Cache-Control: max-age=0, must-revalidate"