diff options
| author | oldmud0 <oldmud0@users.noreply.github.com> | 2019-03-29 21:03:43 -0500 |
|---|---|---|
| committer | oldmud0 <oldmud0@users.noreply.github.com> | 2019-03-29 21:03:43 -0500 |
| commit | 5d0044b93cfd5ada490c7c1b296bdd0f1602a8f2 (patch) | |
| tree | 5786bebd21748987d0481f4f79505aa482214e5e /scripts/wasabi_asset.sh | |
| parent | 9a32aa6e849cab35710aaddd5e2323276e8eccfb (diff) | |
Add a bunch of scripts
Diffstat (limited to 'scripts/wasabi_asset.sh')
| -rwxr-xr-x | scripts/wasabi_asset.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/scripts/wasabi_asset.sh b/scripts/wasabi_asset.sh new file mode 100755 index 00000000..d424183a --- /dev/null +++ b/scripts/wasabi_asset.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# Updates the specified program manifest to a new archive and version +# and uploads the new archive and manifest to S3/Wasabi. +# +# Requires: +# MANIFEST: name of the manifest file +# ARTIFACT_SUFFIX: suffix of the archive to be uploaded (including extension) +# S3_ACCESS_KEY and S3_SECRET_KEY + + +# -E: inherit ERR trap by shell functions +# -e: stop script on ERR trap +# -u: stop script on unbound variables +# -x: print command before running it +# -o pipefail: fail if any command in a pipeline fails +set -Eeuxo pipefail + +aws configure set aws_access_key_id ${S3_ACCESS_KEY} +aws configure set aws_secret_access_key ${S3_SECRET_KEY} +aws configure set default.region us-east-1 + +export S3_COPY="aws s3 cp --endpoint-url=https://s3.wasabisys.com" +export S3_MANIFESTS="s3://ao-manifests" +export S3_ARCHIVES="s3://ao-downloads" + +export VERSION=$(git describe --tags) +export ARCHIVE_FULL="vanilla_full_${VERSION}_${ARTIFACT_SUFFIX}" +export ARCHIVE_INCR="vanilla_update_${VERSION}_${ARTIFACT_SUFFIX}" + +git log --diff-filter=D --summary $(git rev-list --tags --skip=1 --max-count=1)..HEAD | \ + grep "delete mode" | cut -d' ' -f 5- > deletions.txt + +${S3_COPY} ${S3_MANIFESTS}/${MANIFEST} . +if [[ -n FULL_ZIP && FULL_ZIP != '0' ]]; then + node $(dirname $0)/update_manifest.js ${MANIFEST} ${VERSION} + -f ${ARCHIVE_FULL} -i ${ARCHIVE_INCR} deletions.txt + ${S3_COPY} ${ARCHIVE_FULL} ${S3_ARCHIVES} +else + node $(dirname $0)/update_manifest.js ${MANIFEST} ${VERSION} + -i ${ARCHIVE_INCR} deletions.txt +fi +${S3_COPY} ${ARCHIVE_INCR} ${S3_ARCHIVES} +${S3_COPY} ${MANIFEST} ${S3_MANIFESTS} + +rm -f ${MANIFEST} |
