42 lines
1.5 KiB
Bash
Executable File
42 lines
1.5 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -x
|
|
set -e
|
|
|
|
if [ "${BUILD_REASON}" != "PullRequest" ]; then
|
|
cd "$ZIGBUILDDIR"
|
|
|
|
mv ../LICENSE dist/
|
|
mv ../zig-cache/langref.html dist/
|
|
mv dist/bin/zig.exe dist/
|
|
rmdir dist/bin
|
|
|
|
VERSION=$(dist/zig.exe version)
|
|
DIRNAME="zig-windows-x86_64-$VERSION"
|
|
TARBALL="$DIRNAME.zip"
|
|
mv dist "$DIRNAME"
|
|
7z a "$TARBALL" "$DIRNAME"
|
|
|
|
# mv "$DOWNLOADSECUREFILE_SECUREFILEPATH" "$HOME/.s3cfg"
|
|
s3cmd -c "$DOWNLOADSECUREFILE_SECUREFILEPATH" put -P --add-header="cache-control: public, max-age=31536000, immutable" "$TARBALL" s3://ziglang.org/builds/
|
|
|
|
SHASUM=$(sha256sum $TARBALL | cut '-d ' -f1)
|
|
BYTESIZE=$(wc -c < $TARBALL)
|
|
|
|
JSONFILE="windows-$GITBRANCH.json"
|
|
touch $JSONFILE
|
|
echo "{\"tarball\": \"$TARBALL\"," >>$JSONFILE
|
|
echo "\"shasum\": \"$SHASUM\"," >>$JSONFILE
|
|
echo "\"size\": \"$BYTESIZE\"}" >>$JSONFILE
|
|
|
|
s3cmd -c "$DOWNLOADSECUREFILE_SECUREFILEPATH" put -P --add-header="Cache-Control: max-age=0, must-revalidate" "$JSONFILE" "s3://ziglang.org/builds/$JSONFILE"
|
|
s3cmd -c "$DOWNLOADSECUREFILE_SECUREFILEPATH" put -P "$JSONFILE" "s3://ziglang.org/builds/x86_64-windows-$VERSION.json"
|
|
|
|
# `set -x` causes these variables to be mangled.
|
|
# See https://developercommunity.visualstudio.com/content/problem/375679/pipeline-variable-incorrectly-inserts-single-quote.html
|
|
set +x
|
|
echo "##vso[task.setvariable variable=tarball;isOutput=true]$TARBALL"
|
|
echo "##vso[task.setvariable variable=shasum;isOutput=true]$SHASUM"
|
|
echo "##vso[task.setvariable variable=bytesize;isOutput=true]$BYTESIZE"
|
|
fi
|